Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPathEscapes = errors.New("given path would escape")
ErrPathEscapes is returns when a given path would escape, that is, when joined with a path, something outside that path may be accessed.
Functions ¶
func PathsFileReader ¶
PathsFileReader returns a function which searches a list of paths in order, returning the first accessible file, or an error.
Types ¶
type Options ¶
type Options struct { // Stdout is where the console writes. // If nil, then the console writes nowhere. Stdout io.Writer // ModuleLoader is a function which loads JS source by name. // If nil, then then no modules can be loaded (other than embedded ones, // see DisableLibs). ModuleLoader func(name string) ([]byte, error) // FileReader is a function which reads a file into the runtime. If not nil, // then this function is accessible through the name "readFile". FileReader func(filename string) ([]byte, error) // DisableLibs controls access to embedded libraries (lodash, etc). // If false, then they will not be accessible. DisableLibs bool }
Options is provided to NewRuntime to construct a new Runtime.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime wraps a goja runtime.
func NewRuntime ¶
NewRuntime creates a new js runtime. Once the runtime is no longer needed, call Destroy.
func (*Runtime) Destroy ¶
func (r *Runtime) Destroy()
Destroy cleans up the runtime. After calling Destrory, the runtime may not be usable.
Click to show internal directories.
Click to hide internal directories.