js

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2019 License: BSD-2-Clause Imports: 3 Imported by: 26

Documentation

Overview

Package js offers API that works with both GopherJS and Wasm.

The API emulates syscall/js API, so please refer syscall/js API document (https://golang.org/pkg/syscall/js/) for more detail.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInternalObject

func GetInternalObject(v Value) interface{}

Types

type Callback

type Callback = Func

Callback is for backward compatibility. Use Func instead.

func NewCallback

func NewCallback(fn func([]Value)) Callback

NewCallback is for backward compatibility. Use FuncOf instead.

func NewEventCallback

func NewEventCallback(flags EventCallbackFlag, fn func(event Value)) Callback

NewEventCallback is for backward compatibility. Use FuncOf instead.

type Error

type Error struct {
	Value
}

func (Error) Error

func (e Error) Error() string

type EventCallbackFlag

type EventCallbackFlag int

EventCallbackFlag is for backward compatibility.

const (
	PreventDefault EventCallbackFlag = 1 << iota
	StopPropagation
	StopImmediatePropagation
)

type Func added in v1.1.0

type Func struct {
	Value
}

func FuncOf added in v1.1.0

func FuncOf(fn func(this Value, args []Value) interface{}) Func

func (Func) Release added in v1.1.0

func (f Func) Release()

type Type

type Type int
const (
	TypeUndefined Type = iota
	TypeNull
	TypeBoolean
	TypeNumber
	TypeString
	TypeSymbol
	TypeObject
	TypeFunction
)

func (Type) String

func (t Type) String() string

type TypedArray

type TypedArray struct {
	Value
}

func TypedArrayOf

func TypedArrayOf(slice interface{}) TypedArray

func (*TypedArray) Release

func (t *TypedArray) Release()

type Value

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

func Global

func Global() Value

func Null

func Null() Value

func Undefined

func Undefined() Value

func ValueOf

func ValueOf(x interface{}) Value

func (Value) Bool

func (v Value) Bool() bool

func (Value) Call

func (v Value) Call(m string, args ...interface{}) Value

func (Value) Float

func (v Value) Float() float64

func (Value) Get

func (v Value) Get(p string) Value

func (Value) Index

func (v Value) Index(i int) Value

func (Value) InstanceOf

func (v Value) InstanceOf(t Value) bool

func (Value) Int

func (v Value) Int() int

func (Value) Invoke

func (v Value) Invoke(args ...interface{}) Value

func (Value) Length

func (v Value) Length() int

func (Value) New

func (v Value) New(args ...interface{}) Value

func (Value) Set

func (v Value) Set(p string, x interface{})

func (Value) SetIndex

func (v Value) SetIndex(i int, x interface{})

func (Value) String

func (v Value) String() string

func (Value) Type

func (v Value) Type() Type

type ValueError

type ValueError struct {
	Method string
	Type   Type
}

func (*ValueError) Error

func (e *ValueError) Error() string

Jump to

Keyboard shortcuts

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