Documentation ¶
Index ¶
- Variables
- func Async(fn func(this js.Value, args []js.Value) (js.Value, error)) js.Func
- func Await(prom PromiseValue) (res []js.Value, err error)
- func BytesFromUint8Array(src Uint8ArrayValue) []byte
- func EventListener(fn func(event EventValue)) js.Func
- func MarshalJS(v any) (js.Value, error)
- func UnmarshalJS(value js.Value, v any) error
- type ErrorValue
- type EventTargetValue
- type EventValue
- func (e EventValue) Bubbles() bool
- func (e EventValue) Cancelable() bool
- func (e EventValue) Composed() bool
- func (e EventValue) ComposedPath() js.Value
- func (e EventValue) CurrentTarget() EventTargetValue
- func (e EventValue) DefaultPrevented() bool
- func (e EventValue) EventPhase() int
- func (e EventValue) IsTrusted() bool
- func (e EventValue) PreventDefault()
- func (e EventValue) StopImmediatePropagation()
- func (e EventValue) StopPropagation()
- func (e EventValue) Target() EventTargetValue
- func (e EventValue) TimeStamp() float64
- func (e EventValue) Type() string
- type PromiseValue
- type Uint8ArrayValue
Constants ¶
This section is empty.
Variables ¶
var Error errorJS
Error is a wrapper for the Error global object.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
var Event eventJS
Event is a wrapper for the Event global interface.
https://developer.mozilla.org/en-US/docs/Web/API/Event
var EventListenerOptions = &eventListenerOptions{}
EventListenerOptions is used to set event listener options.
var EventOptions = &eventOptions{}
EventOptions is used to set event listener options.
var EventTarget eventTargetJS
EventTarget wraps the EventTarget global interface.
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
var JSON jsonJS
JSON is a wrapper for the JSON global object.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON
var Promise promiseJS
Promise is a wrapper for the Promise global object.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
var Uint8Array uint8ArrayJS
Uint8Array is a wrapper for the Uint8Array global object.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
Functions ¶
func Async ¶ added in v0.0.2
Async is a helper function that wraps the given func in a promise that resolves when no error is returned or rejects when an error is returned.
func Await ¶
func Await(prom PromiseValue) (res []js.Value, err error)
Await is a helper function that waits for a promise to resolve or reject and returns the results and an error value.
func BytesFromUint8Array ¶
func BytesFromUint8Array(src Uint8ArrayValue) []byte
BytesFromUint8Array is a helper function that copies the given Uint8Array into a new byte slice.
func EventListener ¶
func EventListener(fn func(event EventValue)) js.Func
EventListener returns a new event listener callback that calls the given func when an event is received.
Types ¶
type ErrorValue ¶
ErrorValue is an instance of
func (ErrorValue) Error ¶
func (v ErrorValue) Error() string
Error wraps the Error toString prototype method.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/toString
type EventTargetValue ¶
EventTargetValue is an instance of EventTarget.
func (EventTargetValue) AddEventListener ¶
func (e EventTargetValue) AddEventListener(eventType string, listener js.Value, opts ...eventListenerOption)
AddEventListener wraps the EventTarget addEventListener instance method.
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
func (EventTargetValue) DispatchEvent ¶
func (e EventTargetValue) DispatchEvent(event js.Value) bool
DispatchEvent wraps the EventTarget dispatchEvent instance method.
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
func (EventTargetValue) RemoveEventListener ¶
func (e EventTargetValue) RemoveEventListener(eventType string, listener js.Value, options js.Value)
RemoveEventListener wraps the EventTarget removeEventListener instance method.
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener
type EventValue ¶
EventValue is an instance of Event.
func (EventValue) Bubbles ¶
func (e EventValue) Bubbles() bool
Bubbles returns the Event bubbles property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles
func (EventValue) Cancelable ¶
func (e EventValue) Cancelable() bool
Cancelable returns the Event cancelable property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable
func (EventValue) Composed ¶
func (e EventValue) Composed() bool
Composed returns the Event composed property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/composed
func (EventValue) ComposedPath ¶
func (e EventValue) ComposedPath() js.Value
ComposedPath wraps the Event composedPath instance method.
https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath
func (EventValue) CurrentTarget ¶
func (e EventValue) CurrentTarget() EventTargetValue
CurrentTarget returns the Event currentTarget property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
func (EventValue) DefaultPrevented ¶
func (e EventValue) DefaultPrevented() bool
DefaultPrevented returns the Event defaultPrevented property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented
func (EventValue) EventPhase ¶
func (e EventValue) EventPhase() int
EventPhase returns the Event eventPhase property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
func (EventValue) IsTrusted ¶
func (e EventValue) IsTrusted() bool
IsTrusted returns the Event isTrusted property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted
func (EventValue) PreventDefault ¶
func (e EventValue) PreventDefault()
PreventDefault wraps the Event preventDefault instance method.
https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault
func (EventValue) StopImmediatePropagation ¶
func (e EventValue) StopImmediatePropagation()
StopImmediatePropagation wraps the Event stopImmediatePropagation instance method.
https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation
func (EventValue) StopPropagation ¶
func (e EventValue) StopPropagation()
StopPropagation wraps the Event stopPropagation instance method.
https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation
func (EventValue) Target ¶
func (e EventValue) Target() EventTargetValue
Target returns the Event target property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/target
func (EventValue) TimeStamp ¶
func (e EventValue) TimeStamp() float64
TimeStamp returns the Event timeStamp property.
https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp
type PromiseValue ¶
PromiseValue is an instance of Promise.
func PromiseOf ¶
func PromiseOf(fn func(resolve, reject func(value js.Value))) PromiseValue
PromiseOf is a helper function that wraps the given func in a promise.
func (PromiseValue) Catch ¶
func (v PromiseValue) Catch(onRejected js.Func) PromiseValue
Catch wraps the Promise catch prototype method.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
func (PromiseValue) Finally ¶
func (v PromiseValue) Finally(onFinally js.Value) PromiseValue
Finally wraps the Promise finally prototype method.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally
func (PromiseValue) Then ¶
func (v PromiseValue) Then(onFulfilled js.Func) PromiseValue
Then wraps the Promise then prototype method.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then
type Uint8ArrayValue ¶
Uint8ArrayValue is an instance of Uint8Array.
func Uint8ArrayFromBytes ¶
func Uint8ArrayFromBytes(src []byte) Uint8ArrayValue
Uint8ArrayFromBytes is a helper function that copies the given byte slice into a new Uint8Array.
func (Uint8ArrayValue) Length ¶
func (a Uint8ArrayValue) Length() int
Length is a wrapper for Uint8Array length property.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/length