Documentation ¶
Index ¶
- func ConvertOttoToGo(value interface{}) interface{}
- func RegisterInit(init func(env *Environment))
- func ThrowOttoException(call *otto.FunctionCall, format string, arguments ...interface{})
- func VerifyCallArguments(call *otto.FunctionCall, functionName string, expectedArgumentsCount int)
- type Environment
- func (env *Environment) Clone() ext.Environment
- func (env *Environment) HandleEvent(event string, context map[string]interface{}) error
- func (env *Environment) Load(source, code string) error
- func (env *Environment) LoadExtensionsForPath(extensions []*schema.Extension, path string) error
- func (env *Environment) RegisterObject(objectID string, object interface{})
- func (env *Environment) SetUp()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ThrowOttoException ¶
func ThrowOttoException(call *otto.FunctionCall, format string, arguments ...interface{})
ThrowOttoException throws a JavaScript exception that will be passed to Otto
func VerifyCallArguments ¶
func VerifyCallArguments(call *otto.FunctionCall, functionName string, expectedArgumentsCount int)
VerifyCallArguments verify number of calles
Types ¶
type Environment ¶
type Environment struct { VM *otto.Otto DataStore db.DB Identity middleware.IdentityService // contains filtered or unexported fields }
Environment javascript based environment for gohan extension
func NewEnvironment ¶
func NewEnvironment(dataStore db.DB, identity middleware.IdentityService) *Environment
NewEnvironment create new gohan extension environment based on context
func (*Environment) Clone ¶
func (env *Environment) Clone() ext.Environment
Clone makes clone of the environment
func (*Environment) HandleEvent ¶
func (env *Environment) HandleEvent(event string, context map[string]interface{}) error
HandleEvent handles event
func (*Environment) Load ¶
func (env *Environment) Load(source, code string) error
Load loads script for environment
func (*Environment) LoadExtensionsForPath ¶
func (env *Environment) LoadExtensionsForPath(extensions []*schema.Extension, path string) error
LoadExtensionsForPath for returns extensions for specific path
func (*Environment) RegisterObject ¶
func (env *Environment) RegisterObject(objectID string, object interface{})
RegisterObject register new object for VM
Click to show internal directories.
Click to hide internal directories.