js

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runtime added in v0.21.0

type Runtime struct {
	*otto.Otto
	sync.Mutex
	// contains filtered or unexported fields
}

Runtime is a Skydive JavaScript runtime environment

func NewRuntime added in v0.21.0

func NewRuntime() (*Runtime, error)

NewRuntime returns a new JavaScript runtime environment

func (*Runtime) CallFunction added in v0.22.0

func (r *Runtime) CallFunction(source string, params ...interface{}) (otto.Value, error)

CallFunction takes the source of a function and evaluate it with the specified parameters

func (*Runtime) CallPromise added in v0.22.0

func (r *Runtime) CallPromise(source string, params ...interface{}) (chan otto.Value, error)

CallPromise takes the source of a promise and evaluate it with the specified parameters

func (*Runtime) CompleteKeywords added in v0.21.0

func (r *Runtime) CompleteKeywords(line string) []string

CompleteKeywords returns potential continuations for the given line. Since line is evaluated, callers need to make sure that evaluating line does not have side effects.

func (*Runtime) Do added in v0.21.0

func (r *Runtime) Do(fn func(*otto.Otto))

Do executes the `fn` in the event loop

func (*Runtime) Exec added in v0.21.0

func (r *Runtime) Exec(code string) (v otto.Value, err error)

Exec queues the execution of some JavaScript code

func (*Runtime) ExecFunction added in v0.22.0

func (r *Runtime) ExecFunction(source string, params ...interface{}) (v otto.Value, err error)

ExecFunction queues a CallFunction method

func (*Runtime) ExecPromise added in v0.22.0

func (r *Runtime) ExecPromise(source string, params ...interface{}) (v otto.Value, err error)

ExecPromise executes a promise and return its result

func (*Runtime) RegisterAPIClient added in v0.21.0

func (r *Runtime) RegisterAPIClient(client *shttp.CrudClient)

RegisterAPIClient exports Go function required by the API to run inside the client JS VM

func (*Runtime) RunScript added in v0.21.0

func (r *Runtime) RunScript(path string) otto.Value

RunScript executes the specified script

func (*Runtime) Start added in v0.21.0

func (r *Runtime) Start()

Start the runtime evaluation loop

func (*Runtime) Stop added in v0.21.0

func (r *Runtime) Stop()

Stop the runtime evaluation loop

Jump to

Keyboard shortcuts

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