cryptpad/www/common/sframe-protocol.js

33 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-08-09 12:45:39 +00:00
// This file defines all of the RPC calls which are used between the inner and outer iframe.
// Define *querys* (which expect a response) using Q_<query name>
// Define *events* (which expect no response) using EV_<event name>
// Please document the queries and events you create, and please please avoid making generic
// "do stuff" events/queries which are used for many different things because it makes the
// protocol unclear.
2017-08-07 15:23:28 +00:00
define({
2017-08-09 12:45:39 +00:00
// When the iframe first launches, this query is sent repeatedly by the controller
// to wait for it to awake and give it the requirejs config to use.
'Q_INIT': true,
2017-08-07 15:23:28 +00:00
2017-08-09 12:45:39 +00:00
// When either the outside or inside registers a query handler, this is sent.
'EV_REGISTER_HANDLER': true,
// Realtime events called from the outside.
// When someone joins the pad, argument is a string with their netflux id.
'EV_RT_JOIN': true,
// When someone leaves the pad, argument is a string with their netflux id.
'EV_RT_LEAVE': true,
// When you have been disconnected, no arguments.
'EV_RT_DISCONNECT': true,
// When you have connected, argument is an object with myID: string, members: list, readOnly: boolean.
'EV_RT_CONNECT': true,
// Called after the history is finished synchronizing, no arguments.
'EV_RT_READY': true,
// Called from both outside and inside, argument is a (string) chainpad message.
'Q_RT_MESSAGE': true,
// Called from the outside, this informs the inside whenever the user's data has been changed.
// The argument is the object representing the content of the user profile minus the netfluxID
// which changes per-reconnect.
'EV_USERDATA_UPDATE': true
2017-08-07 15:23:28 +00:00
});