sotto

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Otto ottoEngine = 0xD0

Otto is a mapping for the Otto (github.com/robertkrimen/otto) JavaScript engine. This can be used to run JavaScript directly and can be registered by the 'task.RegisterScript' function to include the engine in the XMT task runtime.

Variables

This section is empty.

Functions

func Invoke

func Invoke(s string) (string, error)

Invoke will use the Otto (github.com/robertkrimen/otto) JavaScript engine to run active JavaScript. This can be used to run code not built in at compile time. The only argument is the script that is to be run. The results are the output of the console (all console.log together) and any errors that may occur or syntax errors.

This will capture the output of all the console writes and adds a 'print' statement as a shortcut to be used. Another additional function 'exec' can be used to run commands natively. This function can take a vardict of strings to be the command line arguments.

func InvokeContext

func InvokeContext(x context.Context, s string) (string, error)

InvokeContext will use the Otto (github.com/robertkrimen/otto) JavaScript engine to run active JavaScript. This can be used to run code not built in at compile time. A context is required to timeout the script execution and the script to be run, as a string. The results are the output of the console (all console.log together) and any errors that may occur or syntax errors.

This will capture the output of all the console writes and adds a 'print' statement as a shortcut to be used. Another additional function 'exec' can be used to run commands natively. This function can take a vardict of strings to be the command line arguments.

func InvokeEx

func InvokeEx(x context.Context, m map[string]interface{}, s string) (string, error)

InvokeEx will use the Otto (github.com/robertkrimen/otto) JavaScript engine to run active JavaScript. This can be used to run code not built in at compile time. A context is required to timeout the script execution and the script to be run, as a string. The results are the output of the console (all console.log together) and any errors that may occur or syntax errors.

This will capture the output of all the console writes and adds a 'print' statement as a shortcut to be used. Another additional function 'exec' can be used to run commands natively. This function can take a vardict of strings to be the command line arguments.

This Ex function allows to specify a map that contains any starting variables to be supplied at runtime.

func Register

func Register() error

Register is a simple shortcut for 'task.RegisterEngine(uint8(Otto), Otto)'.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL