trait ContextifyScript extends Object
Contextify Script
- Annotations
- @RawJSType() @native()
- Alphabetic
- By Inheritance
- ContextifyScript
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
createContext(sandbox: Any): ScriptContext
If given a sandbox object, the vm.createContext() method will [prepare that sandbox][#vm_what_does_it_mean_to_contextify_an_object] so that it can be used in calls to vm.runInContext() or script.runInContext().
If given a sandbox object, the vm.createContext() method will [prepare that sandbox][#vm_what_does_it_mean_to_contextify_an_object] so that it can be used in calls to vm.runInContext() or script.runInContext(). Inside such scripts, the sandbox object will be the global object, retaining all of its existing properties but also having the built-in objects and functions any standard global object has. Outside of scripts run by the vm module, sandbox will remain unchanged.
If sandbox is omitted (or passed explicitly as undefined), a new, empty contextified sandbox object will be returned.
The vm.createContext() method is primarily useful for creating a single sandbox that can be used to run multiple scripts. For instance, if emulating a web browser, the method can be used to create a single sandbox representing a window's global object, then run all <script> tags together within the context of that sandbox.
- sandbox
the given sandbox
vm.createContext([sandbox])
- Since
0.11.7
Example: -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
runInContext(contextifiedSandbox: ScriptContext, options: ScriptOptions = null): Any
Runs the compiled code contained by the vm.Script object within the given contextifiedSandbox and returns the result.
Runs the compiled code contained by the vm.Script object within the given contextifiedSandbox and returns the result. Running code does not have access to local scope.
- contextifiedSandbox
A contextified object as returned by the vm.createContext() method.
- options
the optional options
script.runInContext(contextifiedSandbox[, options])
Example: -
def
runInDebugContext(code: String): Any
The vm.runInDebugContext() method compiles and executes code inside the V8 debug context.
The vm.runInDebugContext() method compiles and executes code inside the V8 debug context.
- code
The JavaScript code to compile and run.
vm.runInDebugContext(code)
Example: -
def
runInNewContext(sandbox: Any, options: ScriptOptions = null): Any
First contextifies the given sandbox, runs the compiled code contained by the vm.Script object within the created sandbox, and returns the result.
First contextifies the given sandbox, runs the compiled code contained by the vm.Script object within the created sandbox, and returns the result. Running code does not have access to local scope.
- sandbox
An object that will be contextified. If undefined, a new object will be created.
- options
the optional options
script.runInNewContext([sandbox][, options])
Example: -
def
runInThisContext(options: ScriptOptions = null): ContextifyScript
Runs the compiled code contained by the vm.Script within the context of the current global object.
Runs the compiled code contained by the vm.Script within the context of the current global object. Running code does not have access to local scope, but does have access to the current global object.
- options
the optional options
script.runInThisContext([options])
Example: -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )