channel

package
v0.0.0-...-41cedfc Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: BSD-3-Clause Imports: 5 Imported by: 9

Documentation

Overview

Package channel is websocket and communication between different pages.

Source: HTML Standard (https://html.spec.whatwg.org/)

Index

Constants

View Source
const (
	CONNECTING int = 0
	OPEN       int = 1
	CLOSING    int = 2
	CLOSED     int = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryType

type BinaryType int

enum: BinaryType

const (
	Blob BinaryType = iota
	Arraybuffer
)

func BinaryTypeFromJS

func BinaryTypeFromJS(value js.Value) BinaryType

BinaryTypeFromJS is converting a javascript value into a BinaryType enum value.

func (*BinaryType) JSValue

func (this *BinaryType) JSValue() js.Value

JSValue is converting this enum into a javascript object

func (BinaryType) Value

func (this BinaryType) Value() string

Value is converting this into javascript defined string value

type BroadcastChannel

type BroadcastChannel struct {
	domcore.EventTarget
}

class: BroadcastChannel

func BroadcastChannelFromJS

func BroadcastChannelFromJS(value js.Value) *BroadcastChannel

BroadcastChannelFromJS is casting a js.Value into BroadcastChannel.

func BroadcastChannelFromWrapper

func BroadcastChannelFromWrapper(input core.Wrapper) *BroadcastChannel

BroadcastChannelFromJS is casting from something that holds a js.Value into BroadcastChannel.

func NewBroadcastChannel

func NewBroadcastChannel(name string) (_result *BroadcastChannel)

func (*BroadcastChannel) AddEventMessage

func (_this *BroadcastChannel) AddEventMessage(listener func(event *MessageEvent, currentTarget *BroadcastChannel)) js.Func

AddMessage is adding doing AddEventListener for 'Message' on target. This method is returning allocated javascript function that need to be released.

func (*BroadcastChannel) AddEventMessageError

func (_this *BroadcastChannel) AddEventMessageError(listener func(event *MessageEvent, currentTarget *BroadcastChannel)) js.Func

AddMessageError is adding doing AddEventListener for 'MessageError' on target. This method is returning allocated javascript function that need to be released.

func (*BroadcastChannel) Close

func (_this *BroadcastChannel) Close()

func (*BroadcastChannel) Name

func (_this *BroadcastChannel) Name() string

Name returning attribute 'name' with type string (idl: DOMString).

func (*BroadcastChannel) OnMessage

func (_this *BroadcastChannel) OnMessage() domcore.EventHandlerFunc

OnMessage returning attribute 'onmessage' with type domcore.EventHandler (idl: EventHandlerNonNull).

func (*BroadcastChannel) OnMessageError

func (_this *BroadcastChannel) OnMessageError() domcore.EventHandlerFunc

OnMessageError returning attribute 'onmessageerror' with type domcore.EventHandler (idl: EventHandlerNonNull).

func (*BroadcastChannel) PostMessage

func (_this *BroadcastChannel) PostMessage(message interface{})

func (*BroadcastChannel) SetOnMessage

func (_this *BroadcastChannel) SetOnMessage(listener func(event *MessageEvent, currentTarget *BroadcastChannel)) js.Func

SetOnMessage is assigning a function to 'onmessage'. This This method is returning allocated javascript function that need to be released.

func (*BroadcastChannel) SetOnMessageError

func (_this *BroadcastChannel) SetOnMessageError(listener func(event *MessageEvent, currentTarget *BroadcastChannel)) js.Func

SetOnMessageError is assigning a function to 'onmessageerror'. This This method is returning allocated javascript function that need to be released.

type CloseEvent

type CloseEvent struct {
	domcore.Event
}

class: CloseEvent

func CloseEventFromJS

func CloseEventFromJS(value js.Value) *CloseEvent

CloseEventFromJS is casting a js.Value into CloseEvent.

func CloseEventFromWrapper

func CloseEventFromWrapper(input core.Wrapper) *CloseEvent

CloseEventFromJS is casting from something that holds a js.Value into CloseEvent.

func NewCloseEvent

func NewCloseEvent(_type string, eventInitDict *CloseEventInit) (_result *CloseEvent)

func (*CloseEvent) Code

func (_this *CloseEvent) Code() int

Code returning attribute 'code' with type int (idl: unsigned short).

func (*CloseEvent) Reason

func (_this *CloseEvent) Reason() string

Reason returning attribute 'reason' with type string (idl: USVString).

func (*CloseEvent) WasClean

func (_this *CloseEvent) WasClean() bool

WasClean returning attribute 'wasClean' with type bool (idl: boolean).

type CloseEventInit

type CloseEventInit struct {
	Bubbles    bool
	Cancelable bool
	Composed   bool
	WasClean   bool
	Code       int
	Reason     string
}

dictionary: CloseEventInit

func CloseEventInitFromJS

func CloseEventInitFromJS(value js.Value) *CloseEventInit

CloseEventInitFromJS is allocating a new CloseEventInit object and copy all values in the value javascript object.

func (*CloseEventInit) JSValue

func (_this *CloseEventInit) JSValue() js.Value

JSValue is allocating a new javascript object and copy all values

type MessageChannel

type MessageChannel struct {
	// Value_JS holds a reference to a javascript value
	Value_JS js.Value
}

class: MessageChannel

func MessageChannelFromJS

func MessageChannelFromJS(value js.Value) *MessageChannel

MessageChannelFromJS is casting a js.Value into MessageChannel.

func MessageChannelFromWrapper

func MessageChannelFromWrapper(input core.Wrapper) *MessageChannel

MessageChannelFromJS is casting from something that holds a js.Value into MessageChannel.

func NewMessageChannel

func NewMessageChannel() (_result *MessageChannel)

func (*MessageChannel) JSValue

func (_this *MessageChannel) JSValue() js.Value

JSValue returns the js.Value or js.Null() if _this is nil

func (*MessageChannel) Port1

func (_this *MessageChannel) Port1() *MessagePort

Port1 returning attribute 'port1' with type MessagePort (idl: MessagePort).

func (*MessageChannel) Port2

func (_this *MessageChannel) Port2() *MessagePort

Port2 returning attribute 'port2' with type MessagePort (idl: MessagePort).

type MessageEvent

type MessageEvent struct {
	domcore.Event
}

class: MessageEvent

func MessageEventFromJS

func MessageEventFromJS(value js.Value) *MessageEvent

MessageEventFromJS is casting a js.Value into MessageEvent.

func MessageEventFromWrapper

func MessageEventFromWrapper(input core.Wrapper) *MessageEvent

MessageEventFromJS is casting from something that holds a js.Value into MessageEvent.

func NewMessageEvent

func NewMessageEvent(_type string, eventInitDict *MessageEventInit) (_result *MessageEvent)

func (*MessageEvent) Data

func (_this *MessageEvent) Data() js.Value

Data returning attribute 'data' with type Any (idl: any).

func (*MessageEvent) InitMessageEvent

func (_this *MessageEvent) InitMessageEvent(_type string, bubbles *bool, cancelable *bool, data interface{}, origin *string, lastEventId *string, source *Union, ports []*MessagePort)

func (*MessageEvent) LastEventId

func (_this *MessageEvent) LastEventId() string

LastEventId returning attribute 'lastEventId' with type string (idl: DOMString).

func (*MessageEvent) Origin

func (_this *MessageEvent) Origin() string

Origin returning attribute 'origin' with type string (idl: USVString).

func (*MessageEvent) Ports

func (_this *MessageEvent) Ports() *javascript.FrozenArray

Ports returning attribute 'ports' with type javascript.FrozenArray (idl: FrozenArray).

func (*MessageEvent) Source

func (_this *MessageEvent) Source() *Union

Source returning attribute 'source' with type Union (idl: Union).

type MessageEventInit

type MessageEventInit struct {
	Bubbles     bool
	Cancelable  bool
	Composed    bool
	Data        js.Value
	Origin      string
	LastEventId string
	Source      *Union
	Ports       []*MessagePort
}

dictionary: MessageEventInit

func MessageEventInitFromJS

func MessageEventInitFromJS(value js.Value) *MessageEventInit

MessageEventInitFromJS is allocating a new MessageEventInit object and copy all values in the value javascript object.

func (*MessageEventInit) JSValue

func (_this *MessageEventInit) JSValue() js.Value

JSValue is allocating a new javascript object and copy all values

type MessagePort

type MessagePort struct {
	domcore.EventTarget
}

class: MessagePort

func MessagePortFromJS

func MessagePortFromJS(value js.Value) *MessagePort

MessagePortFromJS is casting a js.Value into MessagePort.

func MessagePortFromWrapper

func MessagePortFromWrapper(input core.Wrapper) *MessagePort

MessagePortFromJS is casting from something that holds a js.Value into MessagePort.

func (*MessagePort) AddEventMessage

func (_this *MessagePort) AddEventMessage(listener func(event *MessageEvent, currentTarget *MessagePort)) js.Func

AddMessage is adding doing AddEventListener for 'Message' on target. This method is returning allocated javascript function that need to be released.

func (*MessagePort) AddEventMessageError

func (_this *MessagePort) AddEventMessageError(listener func(event *MessageEvent, currentTarget *MessagePort)) js.Func

AddMessageError is adding doing AddEventListener for 'MessageError' on target. This method is returning allocated javascript function that need to be released.

func (*MessagePort) Close

func (_this *MessagePort) Close()

func (*MessagePort) OnMessage

func (_this *MessagePort) OnMessage() domcore.EventHandlerFunc

OnMessage returning attribute 'onmessage' with type domcore.EventHandler (idl: EventHandlerNonNull).

func (*MessagePort) OnMessageError

func (_this *MessagePort) OnMessageError() domcore.EventHandlerFunc

OnMessageError returning attribute 'onmessageerror' with type domcore.EventHandler (idl: EventHandlerNonNull).

func (*MessagePort) PostMessage

func (_this *MessagePort) PostMessage(message interface{}, transfer []*javascript.Object)

func (*MessagePort) PostMessage2

func (_this *MessagePort) PostMessage2(message interface{}, options *PostMessageOptions)

func (*MessagePort) SetOnMessage

func (_this *MessagePort) SetOnMessage(listener func(event *MessageEvent, currentTarget *MessagePort)) js.Func

SetOnMessage is assigning a function to 'onmessage'. This This method is returning allocated javascript function that need to be released.

func (*MessagePort) SetOnMessageError

func (_this *MessagePort) SetOnMessageError(listener func(event *MessageEvent, currentTarget *MessagePort)) js.Func

SetOnMessageError is assigning a function to 'onmessageerror'. This This method is returning allocated javascript function that need to be released.

func (*MessagePort) Start

func (_this *MessagePort) Start()

type PostMessageOptions

type PostMessageOptions struct {
	Transfer []*javascript.Object
}

dictionary: PostMessageOptions

func PostMessageOptionsFromJS

func PostMessageOptionsFromJS(value js.Value) *PostMessageOptions

PostMessageOptionsFromJS is allocating a new PostMessageOptions object and copy all values in the value javascript object.

func (*PostMessageOptions) JSValue

func (_this *PostMessageOptions) JSValue() js.Value

JSValue is allocating a new javascript object and copy all values

type Union

type Union struct {
	Value js.Value
}

func UnionFromJS

func UnionFromJS(value js.Value) *Union

func (*Union) JSValue

func (u *Union) JSValue() js.Value

type WebSocket

type WebSocket struct {
	domcore.EventTarget
}

class: WebSocket

func NewWebSocket

func NewWebSocket(url string, protocols *Union) (_result *WebSocket)

func WebSocketFromJS

func WebSocketFromJS(value js.Value) *WebSocket

WebSocketFromJS is casting a js.Value into WebSocket.

func WebSocketFromWrapper

func WebSocketFromWrapper(input core.Wrapper) *WebSocket

WebSocketFromJS is casting from something that holds a js.Value into WebSocket.

func (*WebSocket) AddEventClose

func (_this *WebSocket) AddEventClose(listener func(event *CloseEvent, currentTarget *WebSocket)) js.Func

AddClose is adding doing AddEventListener for 'Close' on target. This method is returning allocated javascript function that need to be released.

func (*WebSocket) AddEventError

func (_this *WebSocket) AddEventError(listener func(event *domcore.Event, currentTarget *WebSocket)) js.Func

AddError is adding doing AddEventListener for 'Error' on target. This method is returning allocated javascript function that need to be released.

func (*WebSocket) AddEventMessage

func (_this *WebSocket) AddEventMessage(listener func(event *MessageEvent, currentTarget *WebSocket)) js.Func

AddMessage is adding doing AddEventListener for 'Message' on target. This method is returning allocated javascript function that need to be released.

func (*WebSocket) AddEventOpen

func (_this *WebSocket) AddEventOpen(listener func(event *domcore.Event, currentTarget *WebSocket)) js.Func

AddOpen is adding doing AddEventListener for 'Open' on target. This method is returning allocated javascript function that need to be released.

func (*WebSocket) BinaryType

func (_this *WebSocket) BinaryType() BinaryType

BinaryType returning attribute 'binaryType' with type BinaryType (idl: BinaryType).

func (*WebSocket) BufferedAmount

func (_this *WebSocket) BufferedAmount() int

BufferedAmount returning attribute 'bufferedAmount' with type int (idl: unsigned long long).

func (*WebSocket) Close

func (_this *WebSocket) Close(code *int, reason *string)

func (*WebSocket) Extensions

func (_this *WebSocket) Extensions() string

Extensions returning attribute 'extensions' with type string (idl: DOMString).

func (*WebSocket) OnClose

func (_this *WebSocket) OnClose() domcore.EventHandlerFunc

OnClose returning attribute 'onclose' with type domcore.EventHandler (idl: EventHandlerNonNull).

func (*WebSocket) OnError

func (_this *WebSocket) OnError() domcore.EventHandlerFunc

OnError returning attribute 'onerror' with type domcore.EventHandler (idl: EventHandlerNonNull).

func (*WebSocket) OnMessage

func (_this *WebSocket) OnMessage() domcore.EventHandlerFunc

OnMessage returning attribute 'onmessage' with type domcore.EventHandler (idl: EventHandlerNonNull).

func (*WebSocket) OnOpen

func (_this *WebSocket) OnOpen() domcore.EventHandlerFunc

OnOpen returning attribute 'onopen' with type domcore.EventHandler (idl: EventHandlerNonNull).

func (*WebSocket) Protocol

func (_this *WebSocket) Protocol() string

Protocol returning attribute 'protocol' with type string (idl: DOMString).

func (*WebSocket) ReadyState

func (_this *WebSocket) ReadyState() int

ReadyState returning attribute 'readyState' with type int (idl: unsigned short).

func (*WebSocket) Send

func (_this *WebSocket) Send(data string)

func (*WebSocket) Send2

func (_this *WebSocket) Send2(data *file.Blob)

func (*WebSocket) Send3

func (_this *WebSocket) Send3(data *javascript.ArrayBuffer)

func (*WebSocket) Send4

func (_this *WebSocket) Send4(data *Union)

func (*WebSocket) SetBinaryType

func (_this *WebSocket) SetBinaryType(value BinaryType)

SetBinaryType setting attribute 'binaryType' with type BinaryType (idl: BinaryType).

func (*WebSocket) SetOnClose

func (_this *WebSocket) SetOnClose(listener func(event *CloseEvent, currentTarget *WebSocket)) js.Func

SetOnClose is assigning a function to 'onclose'. This This method is returning allocated javascript function that need to be released.

func (*WebSocket) SetOnError

func (_this *WebSocket) SetOnError(listener func(event *domcore.Event, currentTarget *WebSocket)) js.Func

SetOnError is assigning a function to 'onerror'. This This method is returning allocated javascript function that need to be released.

func (*WebSocket) SetOnMessage

func (_this *WebSocket) SetOnMessage(listener func(event *MessageEvent, currentTarget *WebSocket)) js.Func

SetOnMessage is assigning a function to 'onmessage'. This This method is returning allocated javascript function that need to be released.

func (*WebSocket) SetOnOpen

func (_this *WebSocket) SetOnOpen(listener func(event *domcore.Event, currentTarget *WebSocket)) js.Func

SetOnOpen is assigning a function to 'onopen'. This This method is returning allocated javascript function that need to be released.

func (*WebSocket) Url

func (_this *WebSocket) Url() string

Url returning attribute 'url' with type string (idl: USVString).

Jump to

Keyboard shortcuts

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