baseobject

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrNotAnObject ErrNotAnObject error
	ErrNotAnObject = errors.New("The given value must be an object")
	//ErrObjectNotNumber ErrObjectNotNumber error
	ErrObjectNotNumber = errors.New("The given object is not a number")
	//ErrObjectNotDouble ErrObjectNotDouble error
	ErrObjectNotDouble = errors.New("The given object is not a double")
	//ErrObjectNotString ErrObjectNotString error
	ErrObjectNotString = errors.New("The given object is not a string")
	//ErrObjectNotBool ErrObjectNotBool error
	ErrObjectNotBool = errors.New("The given object is not boolean")
	//ErrNotAnMEv ErrNotAnMEv error
	ErrNotAnMEv = errors.New("The given value must be an Message Event")
	//ErrNotImplemented ErrNotImplemented error
	ErrNotImplemented = errors.New("Browser not implemented Object")
	//ErrNotImplemented ErrNotImplemented error
	ErrNotABaseObject = errors.New("Not a base object")
	//ErrUnableGetFunctName ErrUnableGetConstructName error
	ErrUnableGetFunctName = errors.New("Unable to get the func name")
	//ErrUnableGetConstruct ErrUnableGetConstruct error
	ErrUnableGetConstruct = errors.New("Unable to get the constructor")
	//ErrNotImplementedFunc ErrNotImplementedFunc error
	ErrNotImplementedFunc = errors.New("Function.prototype.apply was called on undefined, which is a undefined and not a function")
	//ErrUndefinedValue ErrUndefinedValue error
	ErrUndefinedValue = errors.New("Undefined value")
)

Functions

func Call

func Call(obj js.Value, name string, args ...interface{}) (js.Value, error)

func CopyBytesToGo

func CopyBytesToGo(dst []byte, src js.Value) (int, error)

func CopyBytesToJS

func CopyBytesToJS(dst js.Value, src []byte) (int, error)

func Discover

func Discover(obj js.Value) (interface{}, error)

Discover Discover the Object Given and return a Hogosuru Class if the construct is registered

func Eval

func Eval(str string) (js.Value, error)

func Get

func Get(obj js.Value, i interface{}) (js.Value, error)

func GetFuncName

func GetFuncName(inter js.Value) (string, error)

func GetIndex

func GetIndex(obj js.Value, index int) (js.Value, error)

func GetJsValueOf added in v1.1.0

func GetJsValueOf(i interface{}) js.Value

func GoValue

func GoValue(object js.Value) (interface{}, error)

func GoValue_

func GoValue_(object js.Value) interface{}

func Invoke

func Invoke(f js.Value, args ...interface{}) (js.Value, error)

func New

func New(obj js.Value, args ...interface{}) (js.Value, error)

func Register

func Register(inter js.Value, contruct func(js.Value) (interface{}, error)) error

Register Register a construct func for type Object given

func Self added in v1.3.0

func Self() (interface{}, error)

func Set

func Set(obj js.Value, name string, val interface{}) error

func SetConsoleDebug

func SetConsoleDebug(obj interface{})

func SetSyscall

func SetSyscall()

func String

func String(object js.Value) string

String return the string representation of the given Object

func ToStringWithErr

func ToStringWithErr(object js.Value) (string, error)

ToStringWithErr return the ToString representation of the given Object

Types

type BaseObject

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

BaseObject Base Object where all hogosuru herited from

func NewFromJSObject

func NewFromJSObject(obj js.Value) (BaseObject, error)

NewFromJSObject Build a BaseObject from a Js Value Object given

func (BaseObject) BaseObject_

func (b BaseObject) BaseObject_() BaseObject

BaseObject_ Return the current BaseObject

func (BaseObject) Bind

func (b BaseObject) Bind(to BaseObject) (interface{}, error)

Bind Bind

func (BaseObject) Call

func (b BaseObject) Call(name string, args ...interface{}) (js.Value, error)

Call

func (BaseObject) CallBool

func (b BaseObject) CallBool(method string) (bool, error)

CallInt64 Call method given and return a bool int

func (BaseObject) CallInt

func (b BaseObject) CallInt(method string) (int, error)

CallInt Call method given and return int

func (BaseObject) CallInt64

func (b BaseObject) CallInt64(method string) (int64, error)

CallInt64 Call method given and return a 64bit int

func (BaseObject) Class

func (b BaseObject) Class() (string, error)

func (BaseObject) Class_

func (b BaseObject) Class_() string

func (BaseObject) ConstructName

func (b BaseObject) ConstructName() (string, error)

ConstructName Get the construct name

func (BaseObject) ConstructName_

func (b BaseObject) ConstructName_() string

func (BaseObject) Debug

func (b BaseObject) Debug(msg string) error

func (BaseObject) Discover

func (b BaseObject) Discover() (interface{}, error)

Discover Use Discover of this struct

func (BaseObject) Empty

func (b BaseObject) Empty() bool

Empty check if the struct is an empty Struct or have a JS Value attached

func (BaseObject) Export

func (b BaseObject) Export(name string)

func (BaseObject) Get

func (b BaseObject) Get(name string) (js.Value, error)

Get Get Value of object and handle err

func (BaseObject) GetAttributeBool

func (b BaseObject) GetAttributeBool(attribute string) (bool, error)

func (BaseObject) GetAttributeDouble

func (b BaseObject) GetAttributeDouble(attribute string) (float64, error)

func (BaseObject) GetAttributeGlobal

func (b BaseObject) GetAttributeGlobal(attribute string) (interface{}, error)

func (BaseObject) GetAttributeInt

func (b BaseObject) GetAttributeInt(attribute string) (int, error)

func (BaseObject) GetAttributeInt64

func (b BaseObject) GetAttributeInt64(attribute string) (int64, error)

func (BaseObject) GetAttributeString

func (b BaseObject) GetAttributeString(attribute string) (string, error)

func (BaseObject) GetAttributeString_

func (b BaseObject) GetAttributeString_(attribute string) string

func (BaseObject) GetIndex

func (b BaseObject) GetIndex(index int) (js.Value, error)

Get Get Value of object and handle err

func (BaseObject) Implement

func (b BaseObject) Implement(method string) (bool, error)

Implement Check if the stuct implement a given name method

func (BaseObject) JSObject

func (b BaseObject) JSObject() js.Value

JSObject Give the JS Value Object attach to this struct

func (BaseObject) Length

func (b BaseObject) Length() int

Length Length of the JS.Value attached of this strict

func (BaseObject) Set

func (b BaseObject) Set(name string, value interface{}) error

Set Set Value of object and handle err

func (BaseObject) SetAttribute

func (b BaseObject) SetAttribute(attribute string, i interface{}) error

func (BaseObject) SetAttributeBool

func (b BaseObject) SetAttributeBool(attribute string, value bool) error

func (BaseObject) SetAttributeDouble

func (b BaseObject) SetAttributeDouble(attribute string, value float64) error

func (BaseObject) SetAttributeInt

func (b BaseObject) SetAttributeInt(attribute string, value int) error

func (BaseObject) SetAttributeString

func (b BaseObject) SetAttributeString(attribute string, value string) error

func (BaseObject) SetFunc

func (b BaseObject) SetFunc(attribute string, f func(this js.Value, args []js.Value) interface{}) error

func (BaseObject) SetObject

func (b BaseObject) SetObject(object js.Value) BaseObject

SetObject Set the JS value Object to this struct

func (BaseObject) String

func (b BaseObject) String() string

String Get the current string representation of the js Value attached to this struct

func (BaseObject) ToString

func (b BaseObject) ToString() (string, error)

ToString Get the current toString representation of the js Value attached to this struct

func (BaseObject) ToString_

func (b BaseObject) ToString_() string

func (BaseObject) Value

func (b BaseObject) Value() string

Value Equivalent to String()

type ConsoleDebug

type ConsoleDebug interface {
	Debug(opts ...interface{}) error
}

type ObjectFrom

type ObjectFrom interface {
	JSObject() js.Value
	BaseObject_() BaseObject
}

ObjectFrom Interface to check if Object is a BaseObject

Jump to

Keyboard shortcuts

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