Skip to content

Commit

Permalink
Back to old slice without using array.slice.
Browse files Browse the repository at this point in the history
Relates to #275. The code was failing the tests on travis.
  • Loading branch information
ivmartel committed Oct 2, 2016
1 parent d0cd09b commit 7bc9fb8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/utils/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ dwv.browser.check = function()
}
return cloned;
};
// basic Int16Array implementation
Int16Array.prototype.slice = function (begin, end) {
var size = end - begin;
var cloned = new Int16Array(size);
for (var i = 0; i < size; i++) {
cloned[i] = this[begin + i];
}
return cloned;
};
// basic Uint8Array implementation
Uint8Array.prototype.slice = function (begin, end) {
var size = end - begin;
Expand All @@ -125,6 +134,15 @@ dwv.browser.check = function()
}
return cloned;
};
// basic Int8Array implementation
Int8Array.prototype.slice = function (begin, end) {
var size = end - begin;
var cloned = new Int8Array(size);
for (var i = 0; i < size; i++) {
cloned[i] = this[begin + i];
}
return cloned;
};
}
// check clamped array
if( !dwv.browser.hasClampedArray() ) {
Expand Down

0 comments on commit 7bc9fb8

Please sign in to comment.