Skip to content

Commit bb78b52

Browse files
author
Sjoerd Tieleman
committed
Update package.json
1 parent b9ee7fc commit bb78b52

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## codem-isoboxer 0.3.3 (2017/05/05) ##
2+
3+
* fallback for browsers that don't support `Uint8Array.from` (@bbert)
4+
15
## codem-isoboxer 0.3.2 (2017/02/07) ##
26

37
* fix for rounding error on 64-bit numbers (@nicosang)

dist/iso_boxer.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! codem-isoboxer v0.3.2 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */
1+
/*! codem-isoboxer v0.3.3 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */
22
var ISOBoxer = {};
33

44
ISOBoxer.parseBuffer = function(arrayBuffer) {
@@ -690,15 +690,24 @@ ISOBox.prototype._writeTemplate = function(size, value) {
690690
};
691691

692692
ISOBox.prototype._writeData = function(data) {
693+
var i;
693694
if (data instanceof Array) {
694-
data = new DataView(Uint8Array.from(data).buffer);
695+
if (!Uint8Array.from) {
696+
var typedArray = new Uint8Array(data.length);
697+
for (i = 0; i < data.length; i++) {
698+
typedArray[i] = data[i];
699+
}
700+
data = new DataView(typedArray.buffer);
701+
} else {
702+
data = new DataView(Uint8Array.from(data).buffer);
703+
}
695704
}
696705
if (data instanceof Uint8Array) {
697706
data = new DataView(data.buffer);
698707
}
699708
if (this._rawo) {
700709
var offset = this._cursor.offset - this._rawo.byteOffset;
701-
for (var i = 0; i < data.byteLength; i++) {
710+
for (i = 0; i < data.byteLength; i++) {
702711
this._rawo.setUint8(offset + i, data.getUint8(i));
703712
}
704713
this._cursor.offset += data.byteLength;

0 commit comments

Comments
 (0)