Static prefixedReadonly urlThe allowed URL for PostMessage communication
Readonly dataThe dataserializer to use for parse and stringify object into PostMessage
used to unserialize data
used to serialize data
Protected _channelChannel where everything will be broadcast
Private Readonly _socketThe socket used to directly send PostMessage
Private Readonly _domThe domElement which contains socket to send PostMessage (in contentWindow)
Private _previouslyFlag to know if we have a reconnect without a disconnect
Private _listenerPrivate property to save the message eventListener function
Private _isPrivate property to save the statuts of the PostMessage communication.
Constructor of PostMessageChannel
Target of the PostMessageChannel
Url allowed to communicate
Optional __namedParameters: { Optional dataOptional autoBoolean which expose the statuts of the PostMessage communication.
Boolean which expose if it's the parent frame.
Boolean which expose if it's the child frame (iframe).
Send a message into the postMessageChannel
The identifier of the message
Optional data: {} = {}Associated data with the message
Optional waitConnected: boolean = trueIf we delay communication and wait we are connected or not
Register an eventemmiter listener on every socket messages
Rest ...args: [event: string | symbol, fn: ((...args: any[]) => void), context?: any]Register an eventemmiter listener on one socket messages
Rest ...args: [event: string | symbol, fn: ((...args: any[]) => void), context?: any]Add a listener for a given event.
Rest ...args: any[]Optional context: anyRest ...args: any[]Optional context: anyAdd a one-time listener for a given event.
Rest ...args: any[]Optional context: anyRemove the listeners of a given event.
Optional fn: ((...args: any[]) => void)Rest ...args: any[]Optional context: anyOptional once: booleanOptional fn: ((...args: any[]) => void)Rest ...args: any[]Optional context: anyOptional once: booleanRemove all listeners, or those of the specified event.
Optional event: string | symbolPrivate _initializePrivate _messageGenerated using TypeDoc
PostMessageChannel class. This is an class which warp postMessage communication and allow to work with it with higher API. This have dataSerializer feature, auto-connect feature (with defer), ensure url of the target (security), send (with wait connect), listener on messages, and events for lisfecycle of postmessageChannel status