Skip to content
  • deuce's avatar
    Add js.exec(). · d53cddaf
    deuce authored
    This allows executing a new script in a specified scope, much like load().
    There are important differences however...
    1) js.exec() *must* specify a scope.
    2) js.exec()d scripts can call exit() and their handlers are ran then,
       rather than when the parent script exists as in js.load().
    3) The js object is installed in the scope with the real JS object as the
       prototype.  This generally shouldn't be an issue, but if you're doing
       strange things, stranger things may happen.
    4) As part of #3, the exec_path/exec_dir/exec_file/startup_dir/scope
       properties of the JS object represent the new script, not the calling
       one.
    5) js.exec() only searches in the passed startup dir (if specified) and the
       current js.exec_dir path.  It does not search the load paths or the mods
       directory at all.
    
    This API is also subject to change.
    d53cddaf