Documentation
¶
Index ¶
- type Engine
- type Request
- type Runtime
- func (runtime *Runtime) AddFunction(name string, ...) *Runtime
- func (runtime *Runtime) AddObject(name string, ...) *Runtime
- func (runtime *Runtime) Has(name string) bool
- func (runtime *Runtime) Init() error
- func (runtime *Runtime) Load(filename string, name string) error
- func (runtime *Runtime) LoadReader(reader io.Reader, name string, filename ...string) error
- func (runtime *Runtime) New(name string, method string) *Request
- type Script
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface {
Load(filename string, name string) error
LoadReader(reader io.Reader, name string, filename ...string) error
AddFunction(name string, fn func(global map[string]interface{}, sid string, args ...interface{}) interface{}) error
AddObject(name string, methods map[string]func(global map[string]interface{}, sid string, args ...interface{}) interface{}) error
Init() error
Has(name string) bool
Call(data map[string]interface{}, name string, method string, args ...interface{}) (interface{}, error)
}
Engine 脚本接口
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request 请求
func (*Request) WithContext ¶
WithContext with context
func (*Request) WithGlobal ¶
WithGlobal with global data
type Runtime ¶
Runtime 运行时
func (*Runtime) AddFunction ¶
func (runtime *Runtime) AddFunction(name string, fn func(global map[string]interface{}, sid string, args ...interface{}) interface{}) *Runtime
AddFunction add a global JavaScript function
func (*Runtime) AddObject ¶
func (runtime *Runtime) AddObject(name string, methods map[string]func(global map[string]interface{}, sid string, args ...interface{}) interface{}) *Runtime
AddObject add a global JavaScript object
func (*Runtime) LoadReader ¶
LoadReader load and compile script
Click to show internal directories.
Click to hide internal directories.