Last active
November 28, 2015 02:26
-
-
Save petamoriken/11678900319cb0fb4f59 to your computer and use it in GitHub Desktop.
TypedArray の対応する ArrayBuffer の切り出し機能が欲しい。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(let TypedArray of [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]) { | |
Object.defineProperty(TypedArray.prototype, "slicedBuffer", { | |
get: function() { | |
let byteOffset = this.byteOffset, byteLength = this.byteLength; | |
return this.buffer.slice(byteOffset, byteOffset + byteLength); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
spliced というよりかは sliced といった方が良い気がしたので変更した。