Documentation ¶
Overview ¶
Copyright 2018 Ryan Dahl <ry@tinyclouds.org>. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveModule ¶
Types ¶
type ModuleResolverCallback ¶
To resolve modules from javascript.
type ReceiveMessageCallback ¶
To receive messages from javascript.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
This is a golang wrapper around a single V8 Isolate.
func New ¶
func New(cb ReceiveMessageCallback) *Worker
Creates a new worker, which corresponds to a V8 isolate. A single threaded standalone execution context.
func (*Worker) Dispose ¶
func (w *Worker) Dispose()
Forcefully frees up memory associated with worker. GC will also free up worker memory so calling this isn't strictly necessary.
func (*Worker) Load ¶
Load and executes a javascript file with the filename specified by scriptName and the contents of the file specified by the param code.
func (*Worker) LoadModule ¶
func (w *Worker) LoadModule(scriptName string, code string, resolve ModuleResolverCallback) error
LoadModule loads and executes a javascript module with filename specified by scriptName and the contents of the module specified by the param code. All `import` dependencies must be loaded before a script otherwise it will error.
func (*Worker) TerminateExecution ¶
func (w *Worker) TerminateExecution()
Terminates execution of javascript