Skip to main content

Class: Event

protocol.protocol.Event

Represents an Event.

Implements

Constructors

constructor

new Event(properties?): Event

Constructs a new Event.

Parameters

NameTypeDescription
properties?IEventProperties to set

Returns

Event

Properties

name

name: string

Event name.

Implementation of

IEvent.name


payload

payload: string

Event payload.

Implementation of

IEvent.payload

Methods

create

create(properties?): Event

Creates a new Event instance using the specified properties.

Parameters

NameTypeDescription
properties?IEventProperties to set

Returns

Event

Event instance


decode

decode(reader, length?): Event

Decodes an Event message from the specified reader or buffer.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

Event

Event

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): Event

Decodes an Event message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

Event

Event

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode

encode(message, writer?): Writer

Encodes the specified Event message. Does not implicitly verify messages.

Parameters

NameTypeDescription
messageIEventEvent message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

Encodes the specified Event message, length delimited. Does not implicitly verify messages.

Parameters

NameTypeDescription
messageIEventEvent message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): Event

Creates an Event message from a plain object. Also converts values to their respective internal types.

Parameters

NameTypeDescription
objectObjectPlain object

Returns

Event

Event


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for Event

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


toJSON

toJSON(): Object

Converts this Event to JSON.

Returns

Object

JSON object


toObject

toObject(message, options?): Object

Creates a plain object from an Event message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messageEventEvent
options?IConversionOptionsConversion options

Returns

Object

Plain object


verify

verify(message): string

Verifies an Event message.

Parameters

NameTypeDescription
messageObjectPlain object to verify

Returns

string

null if valid, otherwise the reason why it is not