Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am running Node.JS Sandbox module to create a Child Process and I need to be able to have my String Based Javascript access certain functions and Modules of Node. Right now, the Sandbox module is blocking all access to Node API's and functions outside of the Sandbox.

Example

function GetAccessTo() {
return "I want to call this function"
}

var str = "GetAccessTo();"
var s = new Sandbox();
s.run(str, function (output) {
output.result;
            });
share|improve this question

1 Answer

To add methods to the context , go to Shovel.js and add methods to var contextand you will be able to call from your Javascript String

Like this:

s.run("hi('something',function(result){return result})", function (output) {
                logic = output.result;
            });

    var context = Script.createContext();
        context.hi = function(a,b) {
            c="hi"
            return b(c)};
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.