object VM extends Object with VM
Virtual Machine Singleton
- Annotations
- @native() @JSImport( "vm" , JSImport.Namespace )
- Alphabetic
- By Inheritance
- VM
- VM
- 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[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
compileFunction(code: String): Function
- Definition Classes
- VM
-
def
compileFunction(code: String, params: Array[String]): Function
- Definition Classes
- VM
-
def
compileFunction(code: String, params: Array[String], options: CompileFunctionOptions): Function
- Definition Classes
- VM
-
def
createContext(): Context
- Definition Classes
- VM
-
def
createContext(sandbox: Object): Context
- Definition Classes
- VM
-
def
createContext(sandbox: Object, options: CreateContextOptions): Context
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
- Definition Classes
- VM
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[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
isContext(sandbox: Object): Boolean
Returns true if the given sandbox object has been contextified using vm.createContext().
Returns true if the given sandbox object has been contextified using vm.createContext().
- sandbox
the sandbox
- returns
true if the given sandbox object has been contextified using vm.createContext().
- Definition Classes
- VM
-
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
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
runInContext(code: String, contextifiedSandbox: Context): Any
- Definition Classes
- VM
-
def
runInContext(code: String, contextifiedSandbox: Context, options: VMRunInContextOptions): 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.
- code
The JavaScript code to compile and run.
- contextifiedSandbox
A contextified object as returned by the vm.createContext() method.
- options
the optional options
- Definition Classes
- VM
script.runInContext(contextifiedSandbox[, options])
Example: -
def
runInNewContext(code: String, sandbox: Any): Any
- Definition Classes
- VM
-
def
runInNewContext(code: String, sandbox: Any, options: VMRunInNewContextOptions): 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.
- code
The JavaScript code to compile and run.
- sandbox
An object that will be contextified. If undefined, a new object will be created.
- options
the optional options
- Definition Classes
- VM
vm.runInNewContext(code[, sandbox][, options])
Example: -
def
runInThisContext(code: String): Script
- Definition Classes
- VM
-
def
runInThisContext(code: String, options: VMRunInContextOptions): Script
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.
- code
The JavaScript code to compile and run.
- options
the optional options
- Definition Classes
- VM
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( ... ) @native()