W3cubDocs

/Angular

ServiceMessageBroker

interface experimental

Helper class for UIComponents that allows components to register methods. If a registered method message is received from the broker on the worker, the UIMessageBroker deserializes its arguments and calls the registered method. If that method returns a promise, the UIMessageBroker returns the result to the worker.

interface ServiceMessageBroker {
  registerMethod(methodName: string, signature: Array<Type<any> | SerializerTypes> | null, method: (..._: any[]) => Promise<any> | void, returnType?: Type<any> | SerializerTypes): void
}

Methods

registerMethod()

registerMethod(methodName: string, signature: Array<Type<any> | SerializerTypes> | null, method: (..._: any[]) => Promise<any> | void, returnType?: Type<any> | SerializerTypes): void

Parameters

methodName

Type: string.

signature

Type: Array | SerializerTypes> | null.

method

Type: (..._: any[]) => Promise | void.

returnType

Type: Type | SerializerTypes.

Optional. Default is undefined.

Returns

void

© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/platform-webworker/ServiceMessageBroker