[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Typed Array slice() renamed to subset()



Improved shim that is both forward and backward-compatible, ie. shim
slice() for old code on new browsers or use subset() for new code on
old browsers :

function setupTypedArraySubsetCompatibilityShim() {
	var types = [Int8Array, Uint8Array, Int16Array, Uint16Array,
Int32Array, Uint32Array, Float32Array];
	for (var i = 0; i < types.length; ++i) {
		if (types[i].prototype.slice === undefined) {
		    types[i].prototype.slice = types[i].prototype.subset;
                } else if (types[i].prototype.subset === undefined) {
		    types[i].prototype.subset = types[i].prototype.slice;
                }
	}
}


Regards,
-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------