3 ms·
Regarding Arrays: var iframe = document.createElement('iframe'); document.body.appendChild(iframe); xArray = window.frames[window.frames.length-1].Arr
by lqdc13 11y ago
Regarding Arrays:
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
xArray = window.frames[window.frames.length-1].Array;
var a = new xArray(1,2,3);
>> a instanceof Array;
<< false
>> a
<< Array [ 1, 2, 3 ]
>> Object.prototype.toString.call(a) === "[object Array]"
<< true
All I'm saying is there are way too many such things that you have to keep in mind.
- tracker1 11y agoSee `Array.isArray` which you can polyfill however you like ... Beyond that, if you bring primitives from another frame, you kind of get what you deserve. Most likely you should check for not a string, but has `length` property that is a Number and use `Array.from` with your conditions, especially with arguments or dom collections. Most likely when working across frames, you should use messaging, unless you're doing something truly hokey... In either case, working across frames like that is akin to poking into the memory of one process from another. It's bound to have issues... I don't think this is something that WebAssembly would allow you to do in the first place...