IJavaScriptEngine Interface

Summary

A common interface to a JavaScript engine. Every JavaScript engine is obtained from a Wyam.Common.JavaScript.IJavaScriptEnginePool and will be returned to the pool when it is disposed. Therefore, you must dispose the engine when you are done with it.
Assembly
Wyam.Common.dll
Namespace
Wyam.Common.JavaScript
Interfaces
  • IDisposable
Implementing Types
graph BT Type-.->Interface0["IDisposable"] Type["IJavaScriptEngine"] class Type type-node Implementing0["TestJsEngine"]-.->Type click Implementing0 "/api/Wyam.Testing.JavaScript/TestJsEngine"

Syntax

public interface IJavaScriptEngine : IDisposable

Properties

Name Value Summary
Name string
Gets the name of JavaScript engine.
SupportsGarbageCollection bool
Gets a value that indicates if the JavaScript engine supports garbage collection.
SupportsScriptInterruption bool
Gets a value that indicates if the JavaScript engine supports script interruption.
SupportsScriptPrecompilation bool
Gets a value that indicates if the JavaScript engine supports script pre-compilation.
Version string
Gets the version of original JavaScript engine.

Methods

Name Value Summary
CallFunction(string, Object[]) Object
Calls a JavaScript function.
CallFunction<T>(string, Object[]) T
Calls a JavaScript function.
CollectGarbage() void
Performs a full garbage collection.
EmbedHostObject(string, Object) void
Embeds a host object to script code.
EmbedHostType(string, Type) void
Embeds a host type to script code.
Evaluate(string) Object
Evaluates an expression.
Evaluate(string, string) Object
Evaluates an expression.
Evaluate<T>(string) T
Evaluates an expression.
Evaluate<T>(string, string) T
Evaluates an expression.
Execute(IPrecompiledJavaScript) void
Executes a pre-compiled script.
Execute(string) void
Executes JavaScript code.
Execute(string, string) void
Executes a JavaScript code.
ExecuteFile(string, Encoding) void
Executes code from JavaScript file.
ExecuteResource(string, Assembly) void
Executes code from embedded JavaScript resource.
ExecuteResource(string, Type) void
Executes code from embedded JavaScript resource.
GetVariableValue(string) Object
Gets the value of variable.
GetVariableValue<T>(string) T
Gets the value of variable.
HasVariable(string) bool
Checks for the existence of a variable.
Interrupt() void
Interrupts script execution and causes the JavaScript engine to throw an exception.
Precompile(string) IPrecompiledJavaScript
Creates a pre-compiled script from JavaScript code.
Precompile(string, string) IPrecompiledJavaScript
Creates a pre-compiled script from JavaScript code.
PrecompileFile(string, Encoding) IPrecompiledJavaScript
Creates a pre-compiled script from JavaScript file.
PrecompileResource(string, Assembly) IPrecompiledJavaScript
Creates a pre-compiled script from embedded JavaScript resource.
PrecompileResource(string, Type) IPrecompiledJavaScript
Creates a pre-compiled script from embedded JavaScript resource
RemoveVariable(string) void
Removes a variable.
SetVariableValue(string, Object) void
Sets the value of variable.
GitHub