otto

package
v0.0.0-...-b41ccf1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2015 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertOttoToGo

func ConvertOttoToGo(value interface{}) interface{}

ConvertOttoToGo ...

func RegisterInit

func RegisterInit(init func(env *Environment))

RegisterInit registers init code

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

func (*Environment) SetUp

func (env *Environment) SetUp()

SetUp initialize environment

Jump to

Keyboard shortcuts

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