XDMChannel class

表示帧\document 保持活动状态(跨多个 funtion\method 调用)之间的通信通道

构造函数

XDMChannel(Window, string)

方法

error(IJsonRpcMessage, Error)
getObjectRegistry()

获取对象注册表以处理来自此特定通道的消息。 收到消息后,将首先使用此通道注册表,如果在此处找不到处理程序,则将使用全局注册表。

getRemoteObjectProxy<T>(string, Object)

获取一个代理对象,该对象表示在此通道的远程端使用给定实例 ID 注册的对象。

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

通过 RPC 调用方法。 在通道的远程端查找已注册的对象,并调用指定的方法。

onMessage(IJsonRpcMessage)

处理此通道上收到的消息。 调度到通过对象注册表找到的相应对象

owns(Window, string, IJsonRpcMessage)

构造函数详细信息

XDMChannel(Window, string)

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

参数

postToWindow

Window

targetOrigin

string

方法详细信息

error(IJsonRpcMessage, Error)

function error(messageObj: IJsonRpcMessage, errorObj: Error)

参数

messageObj
IJsonRpcMessage
errorObj

Error

getObjectRegistry()

获取对象注册表以处理来自此特定通道的消息。 收到消息后,将首先使用此通道注册表,如果在此处找不到处理程序,则将使用全局注册表。

function getObjectRegistry(): IXDMObjectRegistry

返回

getRemoteObjectProxy<T>(string, Object)

获取一个代理对象,该对象表示在此通道的远程端使用给定实例 ID 注册的对象。

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

参数

instanceId

string

已注册对象的唯一 ID

contextData

Object

要传递给已注册对象的工厂方法的可选上下文数据

返回

Promise<T>

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

通过 RPC 调用方法。 在通道的远程端查找已注册的对象,并调用指定的方法。

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

参数

methodName

string

instanceId

string

已注册对象的唯一 ID

params

any[]

要调用的方法的参数

instanceContextData

Object

要传递给已注册对象的工厂方法的可选上下文数据

serializationSettings
ISerializationSettings

可选序列化设置

返回

Promise<T>

onMessage(IJsonRpcMessage)

处理此通道上收到的消息。 调度到通过对象注册表找到的相应对象

function onMessage(rpcMessage: IJsonRpcMessage): boolean

参数

rpcMessage
IJsonRpcMessage

消息数据

返回

boolean

如此 如果消息由此通道处理。 否则为 false。

owns(Window, string, IJsonRpcMessage)

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

参数

source

Window

origin

string

rpcMessage
IJsonRpcMessage

返回

boolean