duktape

package module
v1.0.0-...-e2ae92f Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2015 License: MIT Imports: 7 Imported by: 12

README

Duktape bindings for Go(Golang) wercker status

Duktape is a thin, embeddable javascript engine. Most of the api is implemented. The exceptions are listed here.

Usage

The package is fully go-getable, no need to install any external C libraries.
So, just type go get gopkg.in/olebedev/go-duktape.v1 to install.

package main

import "fmt"
import "gopkg.in/olebedev/go-duktape.v1"

func main() {
  ctx := duktape.New()
  ctx.EvalString(`2 + 3`)
  result := ctx.GetNumber(-1)
  ctx.Pop()
  fmt.Println("result is:", result)
}
Go specific notes

Bindings between Go and Javascript contexts are not fully functional. However, binding a Go function to the Javascript context is available:

package main

import "fmt"
import "gopkg.in/olebedev/go-duktape.v1"

func main() {
  ctx := duktape.New()
  ctx.PushGlobalGoFunction("log", func(c *duktape.Context) int {
    fmt.Println(c.SafeToString(-1))
    return 0
  })
  ctx.EvalString(`log('Go lang Go!')`)
}

then run it.

$ go run *.go
Go lang Go!
$
Timers

There is a method to inject timers to the global scope:

package main

import "fmt"
import "gopkg.in/olebedev/go-duktape.v1"

func main() {
  ctx := duktape.New()

  // Let's inject `setTimeout`, `setInterval`, `clearTimeout`,
  // `clearInterval` into global scope.
  ctx.DefineTimers()

  ch := make(chan string)
  ctx.PushGlobalGoFunction("second", func(_ *Context) int {
    ch <- "second step"
    return 0
  })
  ctx.PevalString(`
    setTimeout(second, 0);
    print('first step');
  `)
  fmt.Println(<-ch)
}

then run it

$ go run *.go
first step
second step
$
Status

The package is not fully tested, so be careful.

Contribution

Pull requests are welcome!
Convention: fork the repository and make changes on your fork in a feature branch.

Documentation

Index

Constants

View Source
const (
	CompileEval uint = 1 << iota
	CompileFunction
	CompileStrict
	CompileSafe
	CompileNoResult
	CompileNoSource
	CompileStrlen
)
View Source
const (
	TypeMaskNone uint = 1 << iota
	TypeMaskUndefined
	TypeMaskNull
	TypeMaskBoolean
	TypeMaskNumber
	TypeMaskString
	TypeMaskObject
	TypeMaskBuffer
	TypeMaskPointer
	TypeMaskLightFunc
)
View Source
const (
	EnumIncludeNonenumerable uint = 1 << iota
	EnumIncludeInternal
	EnumOwnPropertiesOnly
	EnumArrayIndicesOnly
	EnumSortArrayIndices
	NoProxyBehavior
)
View Source
const (
	ErrNone int = 0

	// Internal to Duktape
	ErrUnimplemented int = 50 + iota
	ErrUnsupported
	ErrInternal
	ErrAlloc
	ErrAssertion
	ErrAPI
	ErrUncaughtError
)
View Source
const (
	// Common prototypes
	ErrError int = 100 + iota
	ErrEval
	ErrRange
	ErrReference
	ErrSyntax
	ErrType
	ErrURI
)
View Source
const (
	// Returned error values
	ErrRetUnimplemented int = -(ErrUnimplemented + iota)
	ErrRetUnsupported
	ErrRetInternal
	ErrRetAlloc
	ErrRetAssertion
	ErrRetAPI
	ErrRetUncaughtError
)
View Source
const (
	ErrRetError int = -(ErrError + iota)
	ErrRetEval
	ErrRetRange
	ErrRetReference
	ErrRetSyntax
	ErrRetType
	ErrRetURI
)
View Source
const (
	ExecSuccess = iota
	ExecError
)
View Source
const (
	LogTrace int = iota
	LogDebug
	LogInfo
	LogWarn
	LogError
	LogFatal
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

func New

func New() *Context

New returns plain initialized duktape context object See: http://duktape.org/api.html#duk_create_heap_default

func (*Context) Alloc

func (d *Context) Alloc(size int)

See: http://duktape.org/api.html#duk_alloc

func (*Context) AllocRaw

func (d *Context) AllocRaw(size int)

See: http://duktape.org/api.html#duk_alloc_raw

func (*Context) Base64Decode

func (d *Context) Base64Decode(index int)

See: http://duktape.org/api.html#duk_base64_decode

func (*Context) Base64Encode

func (d *Context) Base64Encode(index int) string

See: http://duktape.org/api.html#duk_base64_encode

func (*Context) Call

func (d *Context) Call(nargs int)

See: http://duktape.org/api.html#duk_call

func (*Context) CallMethod

func (d *Context) CallMethod(nargs int)

See: http://duktape.org/api.html#duk_call_method

func (*Context) CallProp

func (d *Context) CallProp(objIndex int, nargs int)

See: http://duktape.org/api.html#duk_call_prop

func (*Context) CheckStack

func (d *Context) CheckStack(extra int) bool

See: http://duktape.org/api.html#duk_check_stack

func (*Context) CheckStackTop

func (d *Context) CheckStackTop(top int) bool

See: http://duktape.org/api.html#duk_check_stack_top

func (*Context) CheckType

func (d *Context) CheckType(index int, typ int) bool

See: http://duktape.org/api.html#duk_check_type

func (*Context) CheckTypeMask

func (d *Context) CheckTypeMask(index int, mask uint) bool

See: http://duktape.org/api.html#duk_check_type_mask

func (*Context) Compact

func (d *Context) Compact(objIndex int)

See: http://duktape.org/api.html#duk_compact

func (*Context) Compile

func (d *Context) Compile(flags uint)

See: http://duktape.org/api.html#duk_compile

func (*Context) CompileFile

func (d *Context) CompileFile(flags uint, path string)

See: http://duktape.org/api.html#duk_compile_file

func (*Context) CompileLstring

func (d *Context) CompileLstring(flags uint, src string, len int)

See: http://duktape.org/api.html#duk_compile_lstring

func (*Context) CompileLstringFilename

func (d *Context) CompileLstringFilename(flags uint, src string, len int)

See: http://duktape.org/api.html#duk_compile_lstring_filename

func (*Context) CompileString

func (d *Context) CompileString(flags uint, src string)

See: http://duktape.org/api.html#duk_compile_string

func (*Context) CompileStringFilename

func (d *Context) CompileStringFilename(flags uint, src string)

See: http://duktape.org/api.html#duk_compile_string_filename

func (*Context) Concat

func (d *Context) Concat(count int)

See: http://duktape.org/api.html#duk_concat

func (*Context) Copy

func (d *Context) Copy(fromIndex int, toIndex int)

See: http://duktape.org/api.html#duk_copy

func (*Context) DefProp

func (d *Context) DefProp(objIndex int, flags uint)

See: http://duktape.org/api.html#duk_def_prop

func (*Context) DefineTimers

func (d *Context) DefineTimers() error

DefineTimers defines `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` into global context.

func (*Context) DelProp

func (d *Context) DelProp(objIndex int) bool

See: http://duktape.org/api.html#duk_del_prop

func (*Context) DelPropIndex

func (d *Context) DelPropIndex(objIndex int, arrIndex uint) bool

See: http://duktape.org/api.html#duk_del_prop_index

func (*Context) DelPropString

func (d *Context) DelPropString(objIndex int, key string) bool

See: http://duktape.org/api.html#duk_del_prop_string

func (*Context) Destroy

func (d *Context) Destroy()

Destroy destroy all the references to the functions and freed the pointers

func (*Context) DestroyHeap

func (d *Context) DestroyHeap()

See: http://duktape.org/api.html#duk_destroy_heap

func (*Context) DumpContextStderr

func (d *Context) DumpContextStderr()

See: http://duktape.org/api.html#duk_dump_context_stderr

func (*Context) DumpContextStdout

func (d *Context) DumpContextStdout()

See: http://duktape.org/api.html#duk_dump_context_stdout

func (*Context) Dup

func (d *Context) Dup(fromIndex int)

See: http://duktape.org/api.html#duk_dup

func (*Context) DupTop

func (d *Context) DupTop()

See: http://duktape.org/api.html#duk_dup_top

func (*Context) Enum

func (d *Context) Enum(objIndex int, enumFlags uint)

See: http://duktape.org/api.html#duk_enum

func (*Context) Equals

func (d *Context) Equals(index1 int, index2 int) bool

See: http://duktape.org/api.html#duk_equals

func (*Context) Error

func (d *Context) Error(errCode int, a ...interface{})

Error pushes a new Error object to the stack and throws it. This will call fmt.Sprint, forwarding arguments after the error code, to produce the Error's message.

See: http://duktape.org/api.html#duk_error

func (*Context) ErrorRaw

func (d *Context) ErrorRaw(errCode int, filename string, line int, errMsg string)

func (*Context) Errorf

func (d *Context) Errorf(errCode int, format string, a ...interface{})

Errorf pushes a new Error object to the stack and throws it. This will call fmt.Sprintf, forwarding the format string and additional arguments, to produce the Error's message.

See: http://duktape.org/api.html#duk_error

func (*Context) Eval

func (d *Context) Eval()

See: http://duktape.org/api.html#duk_eval

func (*Context) EvalFile

func (d *Context) EvalFile(path string)

See: http://duktape.org/api.html#duk_eval_file

func (*Context) EvalFileNoresult

func (d *Context) EvalFileNoresult(path string)

See: http://duktape.org/api.html#duk_eval_file_noresult

func (*Context) EvalLstring

func (d *Context) EvalLstring(src string, len int)

See: http://duktape.org/api.html#duk_eval_lstring

func (*Context) EvalLstringNoresult

func (d *Context) EvalLstringNoresult(src string, len int)

See: http://duktape.org/api.html#duk_eval_lstring_noresult

func (*Context) EvalNoresult

func (d *Context) EvalNoresult()

See: http://duktape.org/api.html#duk_eval_noresult

func (*Context) EvalString

func (d *Context) EvalString(src string)

See: http://duktape.org/api.html#duk_eval_string

func (*Context) EvalStringNoresult

func (d *Context) EvalStringNoresult(src string)

See: http://duktape.org/api.html#duk_eval_string_noresult

func (*Context) Fatal

func (d *Context) Fatal(errCode int, errMsg string)

See: http://duktape.org/api.html#duk_fatal

func (*Context) Gc

func (d *Context) Gc(flags uint)

See: http://duktape.org/api.html#duk_gc

func (*Context) GetBoolean

func (d *Context) GetBoolean(index int) bool

See: http://duktape.org/api.html#duk_get_boolean

func (*Context) GetBuffer

func (d *Context) GetBuffer(index int, outSize int)

See: http://duktape.org/api.html#duk_get_buffer

func (*Context) GetContext

func (d *Context) GetContext(index int) *Context

See: http://duktape.org/api.html#duk_get_context

func (*Context) GetCurrentMagic

func (d *Context) GetCurrentMagic() int

See: http://duktape.org/api.html#duk_get_current_magic

func (*Context) GetErrorCode

func (d *Context) GetErrorCode(index int) int

See: http://duktape.org/api.html#duk_get_error_code

func (*Context) GetFinalizer

func (d *Context) GetFinalizer(index int)

See: http://duktape.org/api.html#duk_get_finalizer

func (*Context) GetGlobalString

func (d *Context) GetGlobalString(key string) bool

See: http://duktape.org/api.html#duk_get_global_string

func (*Context) GetHeapptr

func (d *Context) GetHeapptr(index int) unsafe.Pointer

See: http://duktape.org/api.html#duk_get_heapptr

func (*Context) GetInt

func (d *Context) GetInt(index int) int

See: http://duktape.org/api.html#duk_get_int

func (*Context) GetLength

func (d *Context) GetLength(index int) int

See: http://duktape.org/api.html#duk_get_length

func (*Context) GetLstring

func (d *Context) GetLstring(index int, outLen int) string

See: http://duktape.org/api.html#duk_get_lstring

func (*Context) GetMagic

func (d *Context) GetMagic(index int) int

See: http://duktape.org/api.html#duk_get_magic

func (*Context) GetNumber

func (d *Context) GetNumber(index int) float64

See: http://duktape.org/api.html#duk_get_number

func (*Context) GetPointer

func (d *Context) GetPointer(index int) unsafe.Pointer

See: http://duktape.org/api.html#duk_get_pointer

func (*Context) GetProp

func (d *Context) GetProp(objIndex int) bool

See: http://duktape.org/api.html#duk_get_prop

func (*Context) GetPropIndex

func (d *Context) GetPropIndex(objIndex int, arrIndex uint) bool

See: http://duktape.org/api.html#duk_get_prop_index

func (*Context) GetPropString

func (d *Context) GetPropString(objIndex int, key string) bool

See: http://duktape.org/api.html#duk_get_prop_string

func (*Context) GetPrototype

func (d *Context) GetPrototype(index int)

See: http://duktape.org/api.html#duk_get_prototype

func (*Context) GetString

func (d *Context) GetString(i int) string

See: http://duktape.org/api.html#duk_get_string

func (*Context) GetTop

func (d *Context) GetTop() int

See: http://duktape.org/api.html#duk_get_top

func (*Context) GetTopIndex

func (d *Context) GetTopIndex() int

See: http://duktape.org/api.html#duk_get_top_index

func (*Context) GetType

func (d *Context) GetType(index int) Type

See: http://duktape.org/api.html#duk_get_type

func (*Context) GetTypeMask

func (d *Context) GetTypeMask(index int) uint

See: http://duktape.org/api.html#duk_get_type_mask

func (*Context) GetUint

func (d *Context) GetUint(index int) uint

See: http://duktape.org/api.html#duk_get_uint

func (*Context) HasProp

func (d *Context) HasProp(objIndex int) bool

See: http://duktape.org/api.html#duk_has_prop

func (*Context) HasPropIndex

func (d *Context) HasPropIndex(objIndex int, arrIndex uint) bool

See: http://duktape.org/api.html#duk_has_prop_index

func (*Context) HasPropString

func (d *Context) HasPropString(objIndex int, key string) bool

See: http://duktape.org/api.html#duk_has_prop_string

func (*Context) HexDecode

func (d *Context) HexDecode(index int)

See: http://duktape.org/api.html#duk_hex_decode

func (*Context) HexEncode

func (d *Context) HexEncode(index int) string

See: http://duktape.org/api.html#duk_hex_encode

func (*Context) Insert

func (d *Context) Insert(toIndex int)

See: http://duktape.org/api.html#duk_insert

func (*Context) IsArray

func (d *Context) IsArray(index int) bool

See: http://duktape.org/api.html#duk_is_array

func (*Context) IsBoolean

func (d *Context) IsBoolean(index int) bool

See: http://duktape.org/api.html#duk_is_boolean

func (*Context) IsBoundFunction

func (d *Context) IsBoundFunction(index int) bool

See: http://duktape.org/api.html#duk_is_bound_function

func (*Context) IsBuffer

func (d *Context) IsBuffer(index int) bool

See: http://duktape.org/api.html#duk_is_buffer

func (*Context) IsCFunction

func (d *Context) IsCFunction(index int) bool

See: http://duktape.org/api.html#duk_is_c_function

func (*Context) IsCallable

func (d *Context) IsCallable(index int) bool

See: http://duktape.org/api.html#duk_is_callable

func (*Context) IsConstructorCall

func (d *Context) IsConstructorCall() bool

See: http://duktape.org/api.html#duk_is_constructor_call

func (*Context) IsDynamicBuffer

func (d *Context) IsDynamicBuffer(index int) bool

See: http://duktape.org/api.html#duk_is_dynamic_buffer

func (*Context) IsEcmascriptFunction

func (d *Context) IsEcmascriptFunction(index int) bool

See: http://duktape.org/api.html#duk_is_ecmascript_function

func (*Context) IsError

func (d *Context) IsError(index int) bool

See: http://duktape.org/api.html#duk_is_error

func (*Context) IsFixedBuffer

func (d *Context) IsFixedBuffer(index int) bool

See: http://duktape.org/api.html#duk_is_fixed_buffer

func (*Context) IsFunction

func (d *Context) IsFunction(index int) bool

See: http://duktape.org/api.html#duk_is_function

func (*Context) IsNan

func (d *Context) IsNan(index int) bool

See: http://duktape.org/api.html#duk_is_nan

func (*Context) IsNull

func (d *Context) IsNull(index int) bool

See: http://duktape.org/api.html#duk_is_null

func (*Context) IsNullOrUndefined

func (d *Context) IsNullOrUndefined(index int) bool

See: http://duktape.org/api.html#duk_is_null_or_undefined

func (*Context) IsNumber

func (d *Context) IsNumber(index int) bool

See: http://duktape.org/api.html#duk_is_number

func (*Context) IsObject

func (d *Context) IsObject(index int) bool

See: http://duktape.org/api.html#duk_is_object

func (*Context) IsObjectCoercible

func (d *Context) IsObjectCoercible(index int) bool

See: http://duktape.org/api.html#duk_is_object_coercible

func (*Context) IsPointer

func (d *Context) IsPointer(index int) bool

See: http://duktape.org/api.html#duk_is_pointer

func (*Context) IsPrimitive

func (d *Context) IsPrimitive(index int) bool

See: http://duktape.org/api.html#duk_is_primitive

func (*Context) IsStrictCall

func (d *Context) IsStrictCall() bool

See: http://duktape.org/api.html#duk_is_strict_call

func (*Context) IsString

func (d *Context) IsString(index int) bool

See: http://duktape.org/api.html#duk_is_string

func (*Context) IsThread

func (d *Context) IsThread(index int) bool

See: http://duktape.org/api.html#duk_is_thread

func (*Context) IsUndefined

func (d *Context) IsUndefined(index int) bool

See: http://duktape.org/api.html#duk_is_undefined

func (*Context) IsValidIndex

func (d *Context) IsValidIndex(index int) bool

See: http://duktape.org/api.html#duk_is_valid_index

func (*Context) Join

func (d *Context) Join(count int)

See: http://duktape.org/api.html#duk_join

func (*Context) JsonDecode

func (d *Context) JsonDecode(index int)

See: http://duktape.org/api.html#duk_json_decode

func (*Context) JsonEncode

func (d *Context) JsonEncode(index int) string

See: http://duktape.org/api.html#duk_json_encode

func (*Context) Must

func (d *Context) Must() *Context

Must returns existing *Context or throw panic. It is highly recommended to use Must all the time.

func (*Context) New

func (d *Context) New(nargs int)

See: http://duktape.org/api.html#duk_new

func (*Context) Next

func (d *Context) Next(enumIndex int, getValue bool) bool

See: http://duktape.org/api.html#duk_next

func (*Context) NormalizeIndex

func (d *Context) NormalizeIndex(index int) int

See: http://duktape.org/api.html#duk_normalize_index

func (*Context) Pcall

func (d *Context) Pcall(nargs int) int

See: http://duktape.org/api.html#duk_pcall

func (*Context) PcallMethod

func (d *Context) PcallMethod(nargs int) int

See: http://duktape.org/api.html#duk_pcall_method

func (*Context) PcallProp

func (d *Context) PcallProp(objIndex int, nargs int) int

See: http://duktape.org/api.html#duk_pcall_prop

func (*Context) Pcompile

func (d *Context) Pcompile(flags uint) error

See: http://duktape.org/api.html#duk_pcompile

func (*Context) PcompileFile

func (d *Context) PcompileFile(flags uint, path string) error

See: http://duktape.org/api.html#duk_pcompile_file

func (*Context) PcompileLstring

func (d *Context) PcompileLstring(flags uint, src string, len int) error

See: http://duktape.org/api.html#duk_pcompile_lstring

func (*Context) PcompileLstringFilename

func (d *Context) PcompileLstringFilename(flags uint, src string, len int) error

See: http://duktape.org/api.html#duk_pcompile_lstring_filename

func (*Context) PcompileString

func (d *Context) PcompileString(flags uint, src string) error

See: http://duktape.org/api.html#duk_pcompile_string

func (*Context) PcompileStringFilename

func (d *Context) PcompileStringFilename(flags uint, src string) error

See: http://duktape.org/api.html#duk_pcompile_string_filename

func (*Context) Peval

func (d *Context) Peval() error

See: http://duktape.org/api.html#duk_peval

func (*Context) PevalFile

func (d *Context) PevalFile(path string) error

See: http://duktape.org/api.html#duk_peval_file

func (*Context) PevalFileNoresult

func (d *Context) PevalFileNoresult(path string) int

See: http://duktape.org/api.html#duk_peval_file_noresult

func (*Context) PevalLstring

func (d *Context) PevalLstring(src string, len int) error

See: http://duktape.org/api.html#duk_peval_lstring

func (*Context) PevalLstringNoresult

func (d *Context) PevalLstringNoresult(src string, len int) int

See: http://duktape.org/api.html#duk_peval_lstring_noresult

func (*Context) PevalNoresult

func (d *Context) PevalNoresult() int

See: http://duktape.org/api.html#duk_peval_noresult

func (*Context) PevalString

func (d *Context) PevalString(src string) error

See: http://duktape.org/api.html#duk_peval_string

func (*Context) PevalStringNoresult

func (d *Context) PevalStringNoresult(src string) int

See: http://duktape.org/api.html#duk_peval_string_noresult

func (*Context) Pop

func (d *Context) Pop()

See: http://duktape.org/api.html#duk_pop

func (*Context) Pop2

func (d *Context) Pop2()

See: http://duktape.org/api.html#duk_pop_2

func (*Context) Pop3

func (d *Context) Pop3()

See: http://duktape.org/api.html#duk_pop_3

func (*Context) PopN

func (d *Context) PopN(count int)

See: http://duktape.org/api.html#duk_pop_n

func (*Context) PushArray

func (d *Context) PushArray() int

See: http://duktape.org/api.html#duk_push_array

func (*Context) PushBoolean

func (d *Context) PushBoolean(val bool)

See: http://duktape.org/api.html#duk_push_boolean

func (*Context) PushBuffer

func (d *Context) PushBuffer(size int, dynamic bool)

See: http://duktape.org/api.html#duk_push_buffer

func (*Context) PushCFunction

func (d *Context) PushCFunction(fn *[0]byte, nargs int) int

See: http://duktape.org/api.html#duk_push_c_function

func (*Context) PushContextDump

func (d *Context) PushContextDump()

See: http://duktape.org/api.html#duk_push_context_dump

func (*Context) PushCurrentFunction

func (d *Context) PushCurrentFunction()

See: http://duktape.org/api.html#duk_push_current_function

func (*Context) PushCurrentThread

func (d *Context) PushCurrentThread()

See: http://duktape.org/api.html#duk_push_current_thread

func (*Context) PushDynamicBuffer

func (d *Context) PushDynamicBuffer(size int)

See: http://duktape.org/api.html#duk_push_dynamic_buffer

func (*Context) PushErrorObject

func (d *Context) PushErrorObject(errCode int, a ...interface{})

PushErrorObject pushes a new Error object to the stack. This will call fmt.Sprint, forwarding arguments after the error code, to produce the Error's message.

See: http://duktape.org/api.html#duk_push_error_object

func (*Context) PushErrorObjectf

func (d *Context) PushErrorObjectf(errCode int, format string, a ...interface{})

PushErrorObjectf pushes a new Error object to the stack. This will call fmt.Sprintf, forwarding the format string and additional arguments, to produce the Error's message.

See: http://duktape.org/api.html#duk_push_error_object

func (*Context) PushFalse

func (d *Context) PushFalse()

See: http://duktape.org/api.html#duk_push_false

func (*Context) PushFixedBuffer

func (d *Context) PushFixedBuffer(size int)

See: http://duktape.org/api.html#duk_push_fixed_buffer

func (*Context) PushGlobalGoFunction

func (d *Context) PushGlobalGoFunction(name string, fn func(*Context) int) (int, error)

PushGlobalGoFunction push the given function into duktape global object Returns non-negative index (relative to stack bottom) of the pushed function also returns error if the function name is invalid

func (*Context) PushGlobalObject

func (d *Context) PushGlobalObject()

See: http://duktape.org/api.html#duk_push_global_object

func (*Context) PushGlobalStash

func (d *Context) PushGlobalStash()

See: http://duktape.org/api.html#duk_push_global_stash

func (*Context) PushGoFunction

func (d *Context) PushGoFunction(fn func(*Context) int) int

PushGoFunction push the given function into duktape stack, returns non-negative index (relative to stack bottom) of the pushed function

func (*Context) PushHeapStash

func (d *Context) PushHeapStash()

See: http://duktape.org/api.html#duk_push_heap_stash

func (*Context) PushHeapptr

func (d *Context) PushHeapptr(ptr unsafe.Pointer)

See: http://duktape.org/api.html#duk_push_heapptr

func (*Context) PushInt

func (d *Context) PushInt(val int)

See: http://duktape.org/api.html#duk_push_int

func (*Context) PushLstring

func (d *Context) PushLstring(str string, len int) string

See: http://duktape.org/api.html#duk_push_lstring

func (*Context) PushNan

func (d *Context) PushNan()

See: http://duktape.org/api.html#duk_push_nan

func (*Context) PushNull

func (d *Context) PushNull()

See: http://duktape.org/api.html#duk_push_null

func (*Context) PushNumber

func (d *Context) PushNumber(val float64)

See: http://duktape.org/api.html#duk_push_number

func (*Context) PushObject

func (d *Context) PushObject() int

See: http://duktape.org/api.html#duk_push_object

func (*Context) PushPointer

func (d *Context) PushPointer(p unsafe.Pointer)

See: http://duktape.org/api.html#duk_push_pointer

func (*Context) PushString

func (d *Context) PushString(str string) string

See: http://duktape.org/api.html#duk_push_string

func (*Context) PushStringFile

func (d *Context) PushStringFile(path string) string

See: http://duktape.org/api.html#duk_push_string_file

func (*Context) PushThis

func (d *Context) PushThis()

See: http://duktape.org/api.html#duk_push_this

func (*Context) PushThread

func (d *Context) PushThread() int

See: http://duktape.org/api.html#duk_push_thread

func (*Context) PushThreadNewGlobalenv

func (d *Context) PushThreadNewGlobalenv() int

See: http://duktape.org/api.html#duk_push_thread_new_globalenv

func (*Context) PushThreadStash

func (d *Context) PushThreadStash(targetCtx *Context)

See: http://duktape.org/api.html#duk_push_thread_stash

func (*Context) PushTrue

func (d *Context) PushTrue()

See: http://duktape.org/api.html#duk_push_true

func (*Context) PushUint

func (d *Context) PushUint(val uint)

See: http://duktape.org/api.html#duk_push_uint

func (*Context) PushUndefined

func (d *Context) PushUndefined()

See: http://duktape.org/api.html#duk_push_undefined

func (*Context) PutGlobalString

func (d *Context) PutGlobalString(key string) bool

See: http://duktape.org/api.html#duk_put_global_string

func (*Context) PutProp

func (d *Context) PutProp(objIndex int) bool

See: http://duktape.org/api.html#duk_put_prop

func (*Context) PutPropIndex

func (d *Context) PutPropIndex(objIndex int, arrIndex uint) bool

See: http://duktape.org/api.html#duk_put_prop_index

func (*Context) PutPropString

func (d *Context) PutPropString(objIndex int, key string) bool

See: http://duktape.org/api.html#duk_put_prop_string

func (*Context) Remove

func (d *Context) Remove(index int)

See: http://duktape.org/api.html#duk_remove

func (*Context) Replace

func (d *Context) Replace(toIndex int)

See: http://duktape.org/api.html#duk_replace

func (*Context) RequireBoolean

func (d *Context) RequireBoolean(index int) bool

See: http://duktape.org/api.html#duk_require_boolean

func (*Context) RequireBuffer

func (d *Context) RequireBuffer(index int, outSize int)

See: http://duktape.org/api.html#duk_require_buffer

func (*Context) RequireContext

func (d *Context) RequireContext(index int) *Context

See: http://duktape.org/api.html#duk_require_context

func (*Context) RequireHeapptr

func (d *Context) RequireHeapptr(index int) unsafe.Pointer

See: http://duktape.org/api.html#duk_require_heapptr

func (*Context) RequireInt

func (d *Context) RequireInt(index int) int

See: http://duktape.org/api.html#duk_require_int

func (*Context) RequireLstring

func (d *Context) RequireLstring(index int, outLen int) string

See: http://duktape.org/api.html#duk_require_lstring

func (*Context) RequireNormalizeIndex

func (d *Context) RequireNormalizeIndex(index int) int

See: http://duktape.org/api.html#duk_require_normalize_index

func (*Context) RequireNull

func (d *Context) RequireNull(index int)

See: http://duktape.org/api.html#duk_require_null

func (*Context) RequireNumber

func (d *Context) RequireNumber(index int) float64

See: http://duktape.org/api.html#duk_require_number

func (*Context) RequireObjectCoercible

func (d *Context) RequireObjectCoercible(index int)

See: http://duktape.org/api.html#duk_require_object_coercible

func (*Context) RequirePointer

func (d *Context) RequirePointer(index int)

See: http://duktape.org/api.html#duk_require_pointer

func (*Context) RequireStack

func (d *Context) RequireStack(extra int)

See: http://duktape.org/api.html#duk_require_stack

func (*Context) RequireStackTop

func (d *Context) RequireStackTop(top int)

See: http://duktape.org/api.html#duk_require_stack_top

func (*Context) RequireString

func (d *Context) RequireString(index int) string

See: http://duktape.org/api.html#duk_require_string

func (*Context) RequireTopIndex

func (d *Context) RequireTopIndex() int

See: http://duktape.org/api.html#duk_require_top_index

func (*Context) RequireTypeMask

func (d *Context) RequireTypeMask(index int, mask uint)

See: http://duktape.org/api.html#duk_require_type_mask

func (*Context) RequireUint

func (d *Context) RequireUint(index int) uint

See: http://duktape.org/api.html#duk_require_uint

func (*Context) RequireUndefined

func (d *Context) RequireUndefined(index int)

See: http://duktape.org/api.html#duk_require_undefined

func (*Context) RequireValidIndex

func (d *Context) RequireValidIndex(index int)

See: http://duktape.org/api.html#duk_require_valid_index

func (*Context) ResetTimers

func (d *Context) ResetTimers()

func (*Context) ResizeBuffer

func (d *Context) ResizeBuffer(index int, newSize int)

See: http://duktape.org/api.html#duk_resize_buffer

func (*Context) SafeCall

func (d *Context) SafeCall(fn *[0]byte, nargs, nrets int) int

See: http://duktape.org/api.html#duk_safe_call

func (*Context) SafeToLstring

func (d *Context) SafeToLstring(index int, outLen int) string

See: http://duktape.org/api.html#duk_safe_to_lstring

func (*Context) SafeToString

func (d *Context) SafeToString(index int) string

See: http://duktape.org/api.html#duk_safe_to_string

func (*Context) SetFinalizer

func (d *Context) SetFinalizer(index int)

See: http://duktape.org/api.html#duk_set_finalizer

func (*Context) SetGlobalObject

func (d *Context) SetGlobalObject()

See: http://duktape.org/api.html#duk_set_global_object

func (*Context) SetMagic

func (d *Context) SetMagic(index int, magic int)

See: http://duktape.org/api.html#duk_set_magic

func (*Context) SetPrototype

func (d *Context) SetPrototype(index int)

See: http://duktape.org/api.html#duk_set_prototype

func (*Context) SetTop

func (d *Context) SetTop(index int)

See: http://duktape.org/api.html#duk_set_top

func (*Context) StrictEquals

func (d *Context) StrictEquals(index1 int, index2 int) bool

func (*Context) Substring

func (d *Context) Substring(index int, startCharOffset int, endCharOffset int)

See: http://duktape.org/api.html#duk_substring

func (*Context) Swap

func (d *Context) Swap(index1 int, index2 int)

See: http://duktape.org/api.html#duk_swap

func (*Context) SwapTop

func (d *Context) SwapTop(index int)

See: http://duktape.org/api.html#duk_swap_top

func (*Context) Throw

func (d *Context) Throw()

See: http://duktape.org/api.html#duk_throw

func (*Context) ToBoolean

func (d *Context) ToBoolean(index int) bool

See: http://duktape.org/api.html#duk_to_boolean

func (*Context) ToBuffer

func (d *Context) ToBuffer(index int, outSize int)

See: http://duktape.org/api.html#duk_to_buffer

func (*Context) ToDefaultvalue

func (d *Context) ToDefaultvalue(index int, hint int)

See: http://duktape.org/api.html#duk_to_defaultvalue

func (*Context) ToDynamicBuffer

func (d *Context) ToDynamicBuffer(index int, outSize int)

See: http://duktape.org/api.html#duk_to_dynamic_buffer

func (*Context) ToFixedBuffer

func (d *Context) ToFixedBuffer(index int, outSize int)

See: http://duktape.org/api.html#duk_to_fixed_buffer

func (*Context) ToInt

func (d *Context) ToInt(index int) int

See: http://duktape.org/api.html#duk_to_int

func (*Context) ToInt32

func (d *Context) ToInt32(index int) int32

See: http://duktape.org/api.html#duk_to_int32

func (*Context) ToLstring

func (d *Context) ToLstring(index int, outLen int) string

See: http://duktape.org/api.html#duk_to_lstring

func (*Context) ToNull

func (d *Context) ToNull(index int)

See: http://duktape.org/api.html#duk_to_null

func (*Context) ToNumber

func (d *Context) ToNumber(index int) float64

See: http://duktape.org/api.html#duk_to_number

func (*Context) ToObject

func (d *Context) ToObject(index int)

See: http://duktape.org/api.html#duk_to_object

func (*Context) ToPointer

func (d *Context) ToPointer(index int)

See: http://duktape.org/api.html#duk_to_pointer

func (*Context) ToPrimitive

func (d *Context) ToPrimitive(index int, hint int)

See: http://duktape.org/api.html#duk_to_primitive

func (*Context) ToString

func (d *Context) ToString(index int) string

See: http://duktape.org/api.html#duk_to_string

func (*Context) ToUint

func (d *Context) ToUint(index int) uint

See: http://duktape.org/api.html#duk_to_uint

func (*Context) ToUint16

func (d *Context) ToUint16(index int) uint16

See: http://duktape.org/api.html#duk_to_uint16

func (*Context) ToUint32

func (d *Context) ToUint32(index int) uint32

See: http://duktape.org/api.html#duk_to_uint32

func (*Context) ToUndefined

func (d *Context) ToUndefined(index int)

See: http://duktape.org/api.html#duk_to_undefined

func (*Context) Trim

func (d *Context) Trim(index int)

See: http://duktape.org/api.html#duk_trim

func (*Context) XcopyTop

func (d *Context) XcopyTop(fromCtx *Context, count int)

See: http://duktape.org/api.html#duk_xcopy_top

func (*Context) XmoveTop

func (d *Context) XmoveTop(fromCtx *Context, count int)

See: http://duktape.org/api.html#duk_xmove_top

type Error

type Error struct {
	Type       string
	Message    string
	FileName   string
	LineNumber int
	Stack      string
}

func (*Error) Error

func (e *Error) Error() string

type Type

type Type int
const (
	TypeNone Type = iota
	TypeUndefined
	TypeNull
	TypeBoolean
	TypeNumber
	TypeString
	TypeObject
	TypeBuffer
	TypePointer
	TypeLightFunc
)

func (Type) IsBool

func (t Type) IsBool() bool

func (Type) IsBuffer

func (t Type) IsBuffer() bool

func (Type) IsLightFunc

func (t Type) IsLightFunc() bool

func (Type) IsNone

func (t Type) IsNone() bool

func (Type) IsNull

func (t Type) IsNull() bool

func (Type) IsNumber

func (t Type) IsNumber() bool

func (Type) IsObject

func (t Type) IsObject() bool

func (Type) IsPointer

func (t Type) IsPointer() bool

func (Type) IsString

func (t Type) IsString() bool

func (Type) IsUndefined

func (t Type) IsUndefined() bool

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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