Documentation ¶
Overview ¶
Package jsre provides execution environment for JavaScript.
Index ¶
- Variables
- type JSRE
- func (self *JSRE) Compile(filename string, src interface{}) (err error)
- func (jsre *JSRE) CompleteKeywords(line string) []string
- func (self *JSRE) Do(fn func(*otto.Otto))
- func (self *JSRE) Evaluate(code string, w io.Writer) error
- func (self *JSRE) Exec(file string) error
- func (self *JSRE) Get(out_ns string) (v otto.Value, err error)
- func (self *JSRE) Run(in_code string) (v otto.Value, err error)
- func (self *JSRE) Set(in_ns string, v interface{}) (err error)
- func (self *JSRE) Stop(waitForCallbacks bool)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( BigNumber_JS = deps.MustAsset("bignumber.js") Chain3_JS = deps.MustAsset("chain3.js") )
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) CompleteKeywords ¶
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 (*JSRE) Evaluate ¶
Evaluate executes code and pretty prints the result to the specified output stream.
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
Click to show internal directories.
Click to hide internal directories.