XDMChannel class

Represents a channel of communication between frames\document Stays "alive" across multiple funtion\method calls

Constructors

XDMChannel(Window, string)

Methods

error(IJsonRpcMessage, Error)
getObjectRegistry()

Get the object registry to handle messages from this specific channel. Upon receiving a message, this channel registry will be used first, then the global registry will be used if no handler is found here.

getRemoteObjectProxy<T>(string, Object)

Get a proxied object that represents the object registered with the given instance id on the remote side of this channel.

invokeRemoteMethod<T>(string, string, any[], Object, ISerializationSettings)

Invoke a method via RPC. Lookup the registered object on the remote end of the channel and invoke the specified method.

onMessage(IJsonRpcMessage)

Handle a received message on this channel. Dispatch to the appropriate object found via object registry

owns(Window, string, IJsonRpcMessage)

Constructor Details

XDMChannel(Window, string)

new XDMChannel(postToWindow: Window, targetOrigin?: string)

Parameters

postToWindow

Window

targetOrigin

string

Method Details

error(IJsonRpcMessage, Error)

function error(messageObj: IJsonRpcMessage, errorObj: Error)

Parameters

messageObj
IJsonRpcMessage
errorObj

Error

getObjectRegistry()

Get the object registry to handle messages from this specific channel. Upon receiving a message, this channel registry will be used first, then the global registry will be used if no handler is found here.

function getObjectRegistry(): IXDMObjectRegistry

Returns

getRemoteObjectProxy<T>(string, Object)

Get a proxied object that represents the object registered with the given instance id on the remote side of this channel.

function getRemoteObjectProxy<T>(instanceId: string, contextData?: Object): Promise<T>

Parameters

instanceId

string

unique id of the registered object

contextData

Object

Optional context data to pass to a registered object's factory method

Returns

Promise<T>

invokeRemoteMethod<T>(string, string, any[], Object, ISerializationSettings)

Invoke a method via RPC. Lookup the registered object on the remote end of the channel and invoke the specified method.

function invokeRemoteMethod<T>(methodName: string, instanceId: string, params?: any[], instanceContextData?: Object, serializationSettings?: ISerializationSettings): Promise<T>

Parameters

methodName

string

instanceId

string

unique id of the registered object

params

any[]

Arguments to the method to invoke

instanceContextData

Object

Optional context data to pass to a registered object's factory method

serializationSettings
ISerializationSettings

Optional serialization settings

Returns

Promise<T>

onMessage(IJsonRpcMessage)

Handle a received message on this channel. Dispatch to the appropriate object found via object registry

function onMessage(rpcMessage: IJsonRpcMessage): boolean

Parameters

rpcMessage
IJsonRpcMessage

Message data

Returns

boolean

True if the message was handled by this channel. Otherwise false.

owns(Window, string, IJsonRpcMessage)

function owns(source: Window, origin: string, rpcMessage: IJsonRpcMessage): boolean

Parameters

source

Window

origin

string

rpcMessage
IJsonRpcMessage

Returns

boolean