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

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



Hi,

> and then wrapping constructor invocations like this:
>
>    var array = fixupTypedArray(new Float32Array(16));
> If anyone has a suggestion on how to make this cleaner, please post to the list.

You can rather change typed array prototype so that you do not need to
track every constructor invocation, eg :

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)
			continue;
		types[i].prototype.subset = types[i].prototype.slice;
	}
}

Then one call at application startup is enough to support new "subset" name.


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
-----------------------------------------------------------