Instance Methods
-
callRPC(name, data, callback, traceId) common/network/dispatcher.js, line 156
-
Calls an RPC. Use
Dispatcher#registerRPC
orDispatcher#registerAsyncRPC
to register a handler for an RPC.Argument Type Attributes Description name
String Name of the RPC.
data
Object Arbitrary data argument.
callback
function Callback that receives the result of the RPC.
traceId
String <optional>
A trace ID for the event. If not given, one will be randomly generated.
-
fireEvent(name, data, traceId) common/network/dispatcher.js, line 131
-
Fires an event. Use
Dispatcher#subscribe
on the other side to listen for events. The event will be fired locally, as well, so any subscribers for the event attached to this Dispatcher will be called.Argument Type Attributes Description name
String Name of the event.
data
Object <optional>
Event data.
traceId
String <optional>
A trace ID for the event. If not given, one will be randomly generated.
-
registerAsyncRPC(name, handler) common/network/dispatcher.js, line 200
-
Creates a new RPC. This version requires that the RPC asynchronously returns a value, see
Dispatcher#registerAsyncRPC
for a version that allows for synchrony.Argument Type Description name
String Name of the RPC.
handler
function Gets the a data object as the first argument, a callback as the second argument, and a trace id as the third argument. Must invoke the callback, passing in the result of the RPC.
-
registerRPC(name, handler) common/network/dispatcher.js, line 184
-
Creates a new RPC. This version requires that the RPC synchronously returns a value, see
Dispatcher#registerAsyncRPC
for a version that allows for asynchrony.Argument Type Description name
String Name of the RPC.
handler
function Gets the a data object as the first argument and the trace id as the second argument. Must return the result of the RPC.
-
subscribe(eventName, subscriber) → {Binding} common/network/dispatcher.js, line 112
-
Subscribes a function to be called whenever this Dispatcher receives a particular event. Use
Dispatcher#fireEvent
on the other side to fire an event.Argument Type Description eventName
String Name of the event.
subscriber
function Function to call when the event is received. Gets the message data as the first argument and the trace id as the second argument.
A binding, allowing the subscription to be cancelled later.