-
Notifications
You must be signed in to change notification settings - Fork 362
Closed
Description
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:
var myCode = 'wrapper(function(){});';
var initFunc = function(interpreter, scope) {
var wrapper = function(fn) {
fn();
};
interpreter.setProperty(scope, 'wrapper',
interpreter.createNativeFunction(wrapper));
};
var myInterpreter = new Interpreter(myCode, initFunc);
myInterpreter.run();
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.
Metadata
Metadata
Assignees
Labels
No labels