Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFactory ¶
func NewFactory(opts ...jsexecutor.JsEngineOption) jsexecutor.JsEngineFactory
NewFactory creates a new jsexecutor.JsEngineFactory for the V8 engine.
func WithRpcScript ¶
func WithRpcScript(script string) jsexecutor.JsEngineOption
WithRpcScript provides an option to override the default RPC handling script. This allows for custom RPC logic or extending the engine's capabilities. WithRpcScript sets the RPC script for the engine. The script must not be empty.
Types ¶
type Engine ¶
type Engine struct { // Iso is the V8 Isolate, representing a single-threaded VM instance. // It is exposed publicly to allow for advanced custom options. Iso *v8go.Isolate // Ctx is the V8 Context, representing the execution environment. // It is exposed publicly to allow for advanced custom options. Ctx *v8go.Context // Option holds the engine-specific configurations. Option *EngineOption // RpcScript contains the JavaScript code for handling RPC calls. RpcScript string // contains filtered or unexported fields }
Engine implements the jsexecutor.JsEngine interface using the V8 engine. It encapsulates a V8 Isolate and Context.
func (*Engine) Execute ¶
func (e *Engine) Execute(req *jsexecutor.JsRequest) (*jsexecutor.JsResponse, error)
Execute runs a JavaScript request using the RPC script.
type EngineOption ¶
type EngineOption struct{}
EngineOption holds specific configurations for the V8 engine.
Click to show internal directories.
Click to hide internal directories.