You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use higher order functions.
I created a higher-order function outside of the interpreter and exposed it to the sandbox.
However, this fails because the higher order function receives the psuedoFunction and therefore can't call it (TypeError: fn is not a function).
Yes, this is a limitation of the interpreter, it is really hard for external JavaScript to initiate a callback into the interpreter. The solution is to move the higher order function into the interpreted code.
Check out Array.prototype.map. This higher order function takes a function as an argument. To achieve this the map function is written as a polyfill. See the examples from line 869 to line 1046. There are a few more examples if you search for "this.polyfills_.push".
Hey everyone! 馃槉
I'm trying to use higher order functions.
I created a higher-order function outside of the interpreter and exposed it to the sandbox.
However, this fails because the higher order function receives the psuedoFunction and therefore can't call it (
TypeError: fn is not a function
).A minimal test case:
I couldn't find any examples or documentation on how to handle this.
Sandboxed higher order functions work fine, of course.
Not sure if this is intended behaviour, but I would be more than thankful for any leads.
The text was updated successfully, but these errors were encountered: