Documentation ¶
Overview ¶
Package jsre provides execution environment for JavaScript.
Index ¶
- type JSRE
- func (self *JSRE) Bind(name string, v interface{}) error
- func (self *JSRE) Compile(filename string, src interface{}) (err error)
- func (self *JSRE) Eval(code string) (s string, err error)
- func (self *JSRE) Exec(file string) error
- func (self *JSRE) Get(ns string) (v otto.Value, err error)
- func (self *JSRE) PrettyPrint(v interface{}) (val otto.Value, err error)
- func (self *JSRE) Run(code string) (v otto.Value, err error)
- func (self *JSRE) Set(ns string, v interface{}) (err error)
- func (self *JSRE) Stop(waitForCallbacks bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSRE ¶
type JSRE struct {
// contains filtered or unexported fields
}
JSRE is a generic JS runtime environment embedding the otto JS interpreter. It provides some helper functions to - load code from files - run code snippets - require libraries - bind native go objects
func (*JSRE) Bind ¶
Bind assigns value v to a variable in the JS environment This method is deprecated, use Set.
func (*JSRE) Eval ¶
Eval evaluates JS function and returns result in a pretty printed string format.
func (*JSRE) Exec ¶
Exec(file) loads and runs the contents of a file if a relative path is given, the jsre's assetPath is used
func (*JSRE) PrettyPrint ¶
PrettyPrint writes v to standard output.
Click to show internal directories.
Click to hide internal directories.