Trait IMessageEvent

Source
pub trait IMessageEvent: IEvent
where <Self::Data as TryFrom<Value>>::Error: Debug,
{ type Data: TryFrom<Value>; // Provided methods fn data(&self) -> Self::Data { ... } fn origin(&self) -> String { ... } fn last_event_id(&self) -> String { ... } fn source(&self) -> Option<Reference> { ... } fn ports(&self) -> Vec<Reference> { ... } }
Expand description

The MessageEvent interface represents a message received by a target object.

(JavaScript docs)

Required Associated Types§

Source

type Data: TryFrom<Value>

The type of data received with this MessageEvent

Provided Methods§

Source

fn data(&self) -> Self::Data

The data sent by the message emitter.

(JavaScript docs)

Source

fn origin(&self) -> String

A string representing the origin of the message emitter.

(JavaScript docs)

Source

fn last_event_id(&self) -> String

A string representing a unique ID for the event.

(JavaScript docs)

Source

fn source(&self) -> Option<Reference>

A MessageEventSource (which can be a WindowProxy, MessagePort, or ServiceWorker object) representing the message emitter.

(JavaScript docs)

Source

fn ports(&self) -> Vec<Reference>

An array of MessagePort objects representing the ports associated with the channel the message is being sent through (where appropriate, e.g. in channel messaging or when sending a message to a shared worker).

(JavaScript docs)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§