I'm using transferable objects between my main thread and physics worker. The Float32Array is being passed back and forth and it works quite nice. How do I check if Float32Array is neutered?
For example this is an array:
this.transferableArray = new Float32Array();
Send as transferable object
worker.postMessage(this.transferableArray, [this.transferableArray.buffer]);
Currently in my code I check if it's neutered like that:
if (!transferableArray.length) {
return false;
}
Is this the right way of doing it or is there some method which specifically tells if the array is neutered? This is a game so every millisecond gain matters.
after sending an array it's becoming useless so now I'm just unsetting the property after sending it.
now, at any point in time it can be easily checked if it came back by checking