While working on hosting Dojo within Node I arrived at a neat solution to isolate the Dojo code from Node itself: evaluate it in a new context. Here’s how it’s done. var sandbox = {}; process.binding("evals").Script.runInNewContext('this["-eval-"] = function(code){ eval(code); };', sandbox); runInNewContext evaluates the code in a separate JavaScript context, sandboxed within our sandbox object. We then define [...]
