Documentation
¶
Index ¶
- Constants
- type Context
- func (d *Context) Alloc(size int)
- func (d *Context) AllocRaw(size int)
- func (d *Context) Base64Decode(index int)
- func (d *Context) Base64Encode(index int) string
- func (d *Context) Call(nargs int)
- func (d *Context) CallMethod(nargs int)
- func (d *Context) CallProp(objIndex int, nargs int)
- func (d *Context) CheckStack(extra int) bool
- func (d *Context) CheckStackTop(top int) bool
- func (d *Context) CheckType(index int, typ int) bool
- func (d *Context) CheckTypeMask(index int, mask uint) bool
- func (d *Context) Compact(objIndex int)
- func (d *Context) Compile(flags uint)
- func (d *Context) CompileFile(flags uint, path string)
- func (d *Context) CompileLstring(flags uint, src string, len int)
- func (d *Context) CompileLstringFilename(flags uint, src string, len int)
- func (d *Context) CompileString(flags uint, src string)
- func (d *Context) CompileStringFilename(flags uint, src string)
- func (d *Context) Concat(count int)
- func (d *Context) Copy(fromIndex int, toIndex int)
- func (d *Context) DefProp(objIndex int, flags uint)
- func (d *Context) DefineTimers() error
- func (d *Context) DelProp(objIndex int) bool
- func (d *Context) DelPropIndex(objIndex int, arrIndex uint) bool
- func (d *Context) DelPropString(objIndex int, key string) bool
- func (d *Context) Destroy()
- func (d *Context) DestroyHeap()
- func (d *Context) DumpContextStderr()
- func (d *Context) DumpContextStdout()
- func (d *Context) Dup(fromIndex int)
- func (d *Context) DupTop()
- func (d *Context) Enum(objIndex int, enumFlags uint)
- func (d *Context) Equals(index1 int, index2 int) bool
- func (d *Context) Error(errCode int, a ...interface{})
- func (d *Context) ErrorRaw(errCode int, filename string, line int, errMsg string)
- func (d *Context) Errorf(errCode int, format string, a ...interface{})
- func (d *Context) Eval()
- func (d *Context) EvalFile(path string)
- func (d *Context) EvalFileNoresult(path string)
- func (d *Context) EvalLstring(src string, len int)
- func (d *Context) EvalLstringNoresult(src string, len int)
- func (d *Context) EvalNoresult()
- func (d *Context) EvalString(src string)
- func (d *Context) EvalStringNoresult(src string)
- func (d *Context) Fatal(errCode int, errMsg string)
- func (d *Context) Gc(flags uint)
- func (d *Context) GetBoolean(index int) bool
- func (d *Context) GetBuffer(index int, outSize int)
- func (d *Context) GetContext(index int) *Context
- func (d *Context) GetCurrentMagic() int
- func (d *Context) GetErrorCode(index int) int
- func (d *Context) GetFinalizer(index int)
- func (d *Context) GetGlobalString(key string) bool
- func (d *Context) GetHeapptr(index int) unsafe.Pointer
- func (d *Context) GetInt(index int) int
- func (d *Context) GetLength(index int) int
- func (d *Context) GetLstring(index int, outLen int) string
- func (d *Context) GetMagic(index int) int
- func (d *Context) GetNumber(index int) float64
- func (d *Context) GetPointer(index int) unsafe.Pointer
- func (d *Context) GetProp(objIndex int) bool
- func (d *Context) GetPropIndex(objIndex int, arrIndex uint) bool
- func (d *Context) GetPropString(objIndex int, key string) bool
- func (d *Context) GetPrototype(index int)
- func (d *Context) GetString(i int) string
- func (d *Context) GetTop() int
- func (d *Context) GetTopIndex() int
- func (d *Context) GetType(index int) Type
- func (d *Context) GetTypeMask(index int) uint
- func (d *Context) GetUint(index int) uint
- func (d *Context) HasProp(objIndex int) bool
- func (d *Context) HasPropIndex(objIndex int, arrIndex uint) bool
- func (d *Context) HasPropString(objIndex int, key string) bool
- func (d *Context) HexDecode(index int)
- func (d *Context) HexEncode(index int) string
- func (d *Context) Insert(toIndex int)
- func (d *Context) IsArray(index int) bool
- func (d *Context) IsBoolean(index int) bool
- func (d *Context) IsBoundFunction(index int) bool
- func (d *Context) IsBuffer(index int) bool
- func (d *Context) IsCFunction(index int) bool
- func (d *Context) IsCallable(index int) bool
- func (d *Context) IsConstructorCall() bool
- func (d *Context) IsDynamicBuffer(index int) bool
- func (d *Context) IsEcmascriptFunction(index int) bool
- func (d *Context) IsError(index int) bool
- func (d *Context) IsFixedBuffer(index int) bool
- func (d *Context) IsFunction(index int) bool
- func (d *Context) IsNan(index int) bool
- func (d *Context) IsNull(index int) bool
- func (d *Context) IsNullOrUndefined(index int) bool
- func (d *Context) IsNumber(index int) bool
- func (d *Context) IsObject(index int) bool
- func (d *Context) IsObjectCoercible(index int) bool
- func (d *Context) IsPointer(index int) bool
- func (d *Context) IsPrimitive(index int) bool
- func (d *Context) IsStrictCall() bool
- func (d *Context) IsString(index int) bool
- func (d *Context) IsThread(index int) bool
- func (d *Context) IsUndefined(index int) bool
- func (d *Context) IsValidIndex(index int) bool
- func (d *Context) Join(count int)
- func (d *Context) JsonDecode(index int)
- func (d *Context) JsonEncode(index int) string
- func (d *Context) Must() *Context
- func (d *Context) New(nargs int)
- func (d *Context) Next(enumIndex int, getValue bool) bool
- func (d *Context) NormalizeIndex(index int) int
- func (d *Context) Pcall(nargs int) int
- func (d *Context) PcallMethod(nargs int) int
- func (d *Context) PcallProp(objIndex int, nargs int) int
- func (d *Context) Pcompile(flags uint) error
- func (d *Context) PcompileFile(flags uint, path string) error
- func (d *Context) PcompileLstring(flags uint, src string, len int) error
- func (d *Context) PcompileLstringFilename(flags uint, src string, len int) error
- func (d *Context) PcompileString(flags uint, src string) error
- func (d *Context) PcompileStringFilename(flags uint, src string) error
- func (d *Context) Peval() error
- func (d *Context) PevalFile(path string) error
- func (d *Context) PevalFileNoresult(path string) int
- func (d *Context) PevalLstring(src string, len int) error
- func (d *Context) PevalLstringNoresult(src string, len int) int
- func (d *Context) PevalNoresult() int
- func (d *Context) PevalString(src string) error
- func (d *Context) PevalStringNoresult(src string) int
- func (d *Context) Pop()
- func (d *Context) Pop2()
- func (d *Context) Pop3()
- func (d *Context) PopN(count int)
- func (d *Context) PushArray() int
- func (d *Context) PushBoolean(val bool)
- func (d *Context) PushBuffer(size int, dynamic bool)
- func (d *Context) PushCFunction(fn *[0]byte, nargs int) int
- func (d *Context) PushContextDump()
- func (d *Context) PushCurrentFunction()
- func (d *Context) PushCurrentThread()
- func (d *Context) PushDynamicBuffer(size int)
- func (d *Context) PushErrorObject(errCode int, a ...interface{})
- func (d *Context) PushErrorObjectf(errCode int, format string, a ...interface{})
- func (d *Context) PushFalse()
- func (d *Context) PushFixedBuffer(size int)
- func (d *Context) PushGlobalGoFunction(name string, fn func(*Context) int) (int, error)
- func (d *Context) PushGlobalObject()
- func (d *Context) PushGlobalStash()
- func (d *Context) PushGoFunction(fn func(*Context) int) int
- func (d *Context) PushHeapStash()
- func (d *Context) PushHeapptr(ptr unsafe.Pointer)
- func (d *Context) PushInt(val int)
- func (d *Context) PushLstring(str string, len int) string
- func (d *Context) PushNan()
- func (d *Context) PushNull()
- func (d *Context) PushNumber(val float64)
- func (d *Context) PushObject() int
- func (d *Context) PushPointer(p unsafe.Pointer)
- func (d *Context) PushString(str string) string
- func (d *Context) PushStringFile(path string) string
- func (d *Context) PushThis()
- func (d *Context) PushThread() int
- func (d *Context) PushThreadNewGlobalenv() int
- func (d *Context) PushThreadStash(targetCtx *Context)
- func (d *Context) PushTrue()
- func (d *Context) PushUint(val uint)
- func (d *Context) PushUndefined()
- func (d *Context) PutGlobalString(key string) bool
- func (d *Context) PutProp(objIndex int) bool
- func (d *Context) PutPropIndex(objIndex int, arrIndex uint) bool
- func (d *Context) PutPropString(objIndex int, key string) bool
- func (d *Context) Remove(index int)
- func (d *Context) Replace(toIndex int)
- func (d *Context) RequireBoolean(index int) bool
- func (d *Context) RequireBuffer(index int, outSize int)
- func (d *Context) RequireContext(index int) *Context
- func (d *Context) RequireHeapptr(index int) unsafe.Pointer
- func (d *Context) RequireInt(index int) int
- func (d *Context) RequireLstring(index int, outLen int) string
- func (d *Context) RequireNormalizeIndex(index int) int
- func (d *Context) RequireNull(index int)
- func (d *Context) RequireNumber(index int) float64
- func (d *Context) RequireObjectCoercible(index int)
- func (d *Context) RequirePointer(index int)
- func (d *Context) RequireStack(extra int)
- func (d *Context) RequireStackTop(top int)
- func (d *Context) RequireString(index int) string
- func (d *Context) RequireTopIndex() int
- func (d *Context) RequireTypeMask(index int, mask uint)
- func (d *Context) RequireUint(index int) uint
- func (d *Context) RequireUndefined(index int)
- func (d *Context) RequireValidIndex(index int)
- func (d *Context) ResetTimers()
- func (d *Context) ResizeBuffer(index int, newSize int)
- func (d *Context) SafeCall(fn *[0]byte, nargs, nrets int) int
- func (d *Context) SafeToLstring(index int, outLen int) string
- func (d *Context) SafeToString(index int) string
- func (d *Context) SetFinalizer(index int)
- func (d *Context) SetGlobalObject()
- func (d *Context) SetMagic(index int, magic int)
- func (d *Context) SetPrototype(index int)
- func (d *Context) SetTop(index int)
- func (d *Context) StrictEquals(index1 int, index2 int) bool
- func (d *Context) Substring(index int, startCharOffset int, endCharOffset int)
- func (d *Context) Swap(index1 int, index2 int)
- func (d *Context) SwapTop(index int)
- func (d *Context) Throw()
- func (d *Context) ToBoolean(index int) bool
- func (d *Context) ToBuffer(index int, outSize int)
- func (d *Context) ToDefaultvalue(index int, hint int)
- func (d *Context) ToDynamicBuffer(index int, outSize int)
- func (d *Context) ToFixedBuffer(index int, outSize int)
- func (d *Context) ToInt(index int) int
- func (d *Context) ToInt32(index int) int32
- func (d *Context) ToLstring(index int, outLen int) string
- func (d *Context) ToNull(index int)
- func (d *Context) ToNumber(index int) float64
- func (d *Context) ToObject(index int)
- func (d *Context) ToPointer(index int)
- func (d *Context) ToPrimitive(index int, hint int)
- func (d *Context) ToString(index int) string
- func (d *Context) ToUint(index int) uint
- func (d *Context) ToUint16(index int) uint16
- func (d *Context) ToUint32(index int) uint32
- func (d *Context) ToUndefined(index int)
- func (d *Context) Trim(index int)
- func (d *Context) XcopyTop(fromCtx *Context, count int)
- func (d *Context) XmoveTop(fromCtx *Context, count int)
- type Error
- type Type
- func (t Type) IsBool() bool
- func (t Type) IsBuffer() bool
- func (t Type) IsLightFunc() bool
- func (t Type) IsNone() bool
- func (t Type) IsNull() bool
- func (t Type) IsNumber() bool
- func (t Type) IsObject() bool
- func (t Type) IsPointer() bool
- func (t Type) IsString() bool
- func (t Type) IsUndefined() bool
- func (t Type) String() string
Constants ¶
const ( CompileEval uint = 1 << iota CompileFunction CompileStrict CompileSafe CompileNoResult CompileNoSource CompileStrlen )
const ( TypeMaskNone uint = 1 << iota TypeMaskUndefined TypeMaskNull TypeMaskBoolean TypeMaskNumber TypeMaskString TypeMaskObject TypeMaskBuffer TypeMaskPointer TypeMaskLightFunc )
const ( EnumIncludeNonenumerable uint = 1 << iota EnumIncludeInternal EnumOwnPropertiesOnly EnumArrayIndicesOnly EnumSortArrayIndices NoProxyBehavior )
const ( ErrNone int = 0 // Internal to Duktape ErrUnimplemented int = 50 + iota ErrUnsupported ErrInternal ErrAlloc ErrAssertion ErrAPI ErrUncaughtError )
const ( // Common prototypes ErrError int = 100 + iota ErrEval ErrRange ErrReference ErrSyntax ErrType ErrURI )
const ( // Returned error values ErrRetUnimplemented int = -(ErrUnimplemented + iota) ErrRetUnsupported ErrRetInternal ErrRetAlloc ErrRetAssertion ErrRetAPI ErrRetUncaughtError )
const ( ErrRetError int = -(ErrError + iota) ErrRetEval ErrRetRange ErrRetReference ErrRetSyntax ErrRetType ErrRetURI )
const ( ExecSuccess = iota ExecError )
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) Base64Decode ¶
func (*Context) Base64Encode ¶
func (*Context) CallMethod ¶
func (*Context) CheckStack ¶
func (*Context) CheckStackTop ¶
func (*Context) CheckTypeMask ¶
func (*Context) CompileFile ¶
func (*Context) CompileLstring ¶
func (*Context) CompileLstringFilename ¶
See: http://duktape.org/api.html#duk_compile_lstring_filename
func (*Context) CompileString ¶
func (*Context) CompileStringFilename ¶
See: http://duktape.org/api.html#duk_compile_string_filename
func (*Context) DefineTimers ¶
DefineTimers defines `setTimeout`, `clearTimeout`, `setInterval`, `clearInterval` into global context.
func (*Context) DelPropIndex ¶
func (*Context) DelPropString ¶
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()
func (*Context) DumpContextStderr ¶
func (d *Context) DumpContextStderr()
func (*Context) DumpContextStdout ¶
func (d *Context) DumpContextStdout()
func (*Context) Error ¶
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.
func (*Context) Errorf ¶
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.
func (*Context) EvalFileNoresult ¶
func (*Context) EvalLstring ¶
func (*Context) EvalLstringNoresult ¶
func (*Context) EvalNoresult ¶
func (d *Context) EvalNoresult()
func (*Context) EvalString ¶
func (*Context) EvalStringNoresult ¶
func (*Context) GetBoolean ¶
func (*Context) GetContext ¶
func (*Context) GetCurrentMagic ¶
func (*Context) GetErrorCode ¶
func (*Context) GetFinalizer ¶
func (*Context) GetGlobalString ¶
func (*Context) GetHeapptr ¶
func (*Context) GetLstring ¶
func (*Context) GetPointer ¶
func (*Context) GetPropIndex ¶
func (*Context) GetPropString ¶
func (*Context) GetPrototype ¶
func (*Context) GetTopIndex ¶
func (*Context) GetTypeMask ¶
func (*Context) HasPropIndex ¶
func (*Context) HasPropString ¶
func (*Context) IsBoundFunction ¶
func (*Context) IsCFunction ¶
func (*Context) IsCallable ¶
func (*Context) IsConstructorCall ¶
func (*Context) IsDynamicBuffer ¶
func (*Context) IsEcmascriptFunction ¶
func (*Context) IsFixedBuffer ¶
func (*Context) IsFunction ¶
func (*Context) IsNullOrUndefined ¶
func (*Context) IsObjectCoercible ¶
func (*Context) IsPrimitive ¶
func (*Context) IsStrictCall ¶
func (*Context) IsUndefined ¶
func (*Context) IsValidIndex ¶
func (*Context) JsonDecode ¶
func (*Context) JsonEncode ¶
func (*Context) Must ¶
Must returns existing *Context or throw panic. It is highly recommended to use Must all the time.
func (*Context) NormalizeIndex ¶
func (*Context) PcallMethod ¶
func (*Context) PcompileFile ¶
func (*Context) PcompileLstring ¶
func (*Context) PcompileLstringFilename ¶
See: http://duktape.org/api.html#duk_pcompile_lstring_filename
func (*Context) PcompileString ¶
func (*Context) PcompileStringFilename ¶
See: http://duktape.org/api.html#duk_pcompile_string_filename
func (*Context) PevalFileNoresult ¶
func (*Context) PevalLstring ¶
func (*Context) PevalLstringNoresult ¶
func (*Context) PevalNoresult ¶
func (*Context) PevalString ¶
func (*Context) PevalStringNoresult ¶
func (*Context) PushBoolean ¶
func (*Context) PushBuffer ¶
func (*Context) PushCFunction ¶
func (*Context) PushContextDump ¶
func (d *Context) PushContextDump()
func (*Context) PushCurrentFunction ¶
func (d *Context) PushCurrentFunction()
func (*Context) PushCurrentThread ¶
func (d *Context) PushCurrentThread()
func (*Context) PushDynamicBuffer ¶
func (*Context) PushErrorObject ¶
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.
func (*Context) PushErrorObjectf ¶
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.
func (*Context) PushFixedBuffer ¶
func (*Context) PushGlobalGoFunction ¶
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()
func (*Context) PushGlobalStash ¶
func (d *Context) PushGlobalStash()
func (*Context) PushGoFunction ¶
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()
func (*Context) PushHeapptr ¶
func (*Context) PushLstring ¶
func (*Context) PushNumber ¶
func (*Context) PushObject ¶
func (*Context) PushPointer ¶
func (*Context) PushString ¶
func (*Context) PushStringFile ¶
func (*Context) PushThread ¶
func (*Context) PushThreadNewGlobalenv ¶
See: http://duktape.org/api.html#duk_push_thread_new_globalenv
func (*Context) PushThreadStash ¶
func (*Context) PushUndefined ¶
func (d *Context) PushUndefined()
func (*Context) PutGlobalString ¶
func (*Context) PutPropIndex ¶
func (*Context) PutPropString ¶
func (*Context) RequireBoolean ¶
func (*Context) RequireBuffer ¶
func (*Context) RequireContext ¶
func (*Context) RequireHeapptr ¶
func (*Context) RequireInt ¶
func (*Context) RequireLstring ¶
func (*Context) RequireNormalizeIndex ¶
See: http://duktape.org/api.html#duk_require_normalize_index
func (*Context) RequireNull ¶
func (*Context) RequireNumber ¶
func (*Context) RequireObjectCoercible ¶
See: http://duktape.org/api.html#duk_require_object_coercible
func (*Context) RequirePointer ¶
func (*Context) RequireStack ¶
func (*Context) RequireStackTop ¶
func (*Context) RequireString ¶
func (*Context) RequireTopIndex ¶
func (*Context) RequireTypeMask ¶
func (*Context) RequireUint ¶
func (*Context) RequireUndefined ¶
func (*Context) RequireValidIndex ¶
func (*Context) ResetTimers ¶
func (d *Context) ResetTimers()
func (*Context) ResizeBuffer ¶
func (*Context) SafeToLstring ¶
func (*Context) SafeToString ¶
func (*Context) SetFinalizer ¶
func (*Context) SetGlobalObject ¶
func (d *Context) SetGlobalObject()