NeedsExamples
gadgets.rpc
Provides operations for making remote procedure calls for gadget-to-container, container-to-gadget, and gadget-to-gadget communication.
Methods
gadgets.rpc.call
;<static> gadgets.rpc.call(targetId, serviceName, callback, var_args)
Parameters
NameTypeDescription |
targetId |
String |
ID of the RPC service provider; empty if calling the parent container |
|
serviceName |
String |
Service name to call |
|
callback |
Function |
null |
Callback function (if any) to process the return value of the RPC request. The callback function will not be called until after the existing callstack has completed execution. |
var_args |
Parameters for the RPC request |
Description
Calls an RPC service.
gadgets.rpc.register
;<static> gadgets.rpc.register(serviceName, handler)
Parameters
NameTypeDescription |
serviceName |
String |
Service name to register |
handler |
Function |
Service handler |
Description
Registers an RPC service.
gadgets.rpc.registerDefault
;<static> gadgets.rpc.registerDefault(handler)
Parameters
NameTypeDescription |
handler |
Function |
Service handler |
Description
Registers a default service handler to process all unknown remote procedure calls, which fail silently by default.
gadgets.rpc.unregister
;<static> gadgets.rpc.unregister(serviceName)
Parameters
NameTypeDescription |
serviceName |
String |
Service name to unregister |
Description
Unregisters an RPC service.
gadgets.rpc.unregisterDefault
;<static> gadgets.rpc.unregisterDefault()
Description
Unregisters the default service handler. Future unknown remote procedure calls will fail silently.
{{ JsApiAlphaList_(v0.9) }}