Add mailbox inner channel

pull/1/head
yflory 6 years ago
parent 11b57cddb1
commit 3feb310fc4

@ -656,6 +656,12 @@ define([
}; };
cursor.onEvent = Util.mkEvent(); cursor.onEvent = Util.mkEvent();
// Mailbox
var mailbox = common.mailbox = {};
mailbox.execCommand = function (data, cb) {
postMessage("MAILBOX_COMMAND", data, cb);
};
mailbox.onEvent = Util.mkEvent();
// Pad RPC // Pad RPC
var pad = common.padRpc = {}; var pad = common.padRpc = {};
@ -1096,6 +1102,8 @@ define([
CHAT_EVENT: common.messenger.onEvent.fire, CHAT_EVENT: common.messenger.onEvent.fire,
// Cursor // Cursor
CURSOR_EVENT: common.cursor.onEvent.fire, CURSOR_EVENT: common.cursor.onEvent.fire,
// Mailbox
MAILBOX_EVENT: common.mailbox.onEvent.fire,
// Pad // Pad
PAD_READY: common.padRpc.onReadyEvent.fire, PAD_READY: common.padRpc.onReadyEvent.fire,
PAD_MESSAGE: common.padRpc.onMessageEvent.fire, PAD_MESSAGE: common.padRpc.onMessageEvent.fire,

@ -0,0 +1,35 @@
define([
'/common/common-util.js',
'/common/common-constants.js',
'/customize/messages.js',
'/bower_components/chainpad-netflux/chainpad-netflux.js',
'/bower_components/chainpad-crypto/crypto.js',
], function (Util, Constants, Messages, CpNetflux, Crypto) {
var Mailbox = {};
Mailbox.init = function (store, waitFor, emit) {
var mailbox = {};
var ctx = {
store: store,
emit: emit,
};
mailbox.removeClient = function (clientId) {
// TODO
//removeClient(ctx, clientId);
};
mailbox.leavePad = function (padChan) {
// TODO
//leaveChannel(ctx, padChan);
};
mailbox.execCommand = function (clientId, obj, cb) {
var cmd = obj.cmd;
var data = obj.data;
};
return mailbox;
};
return Mailbox;
});

@ -66,6 +66,8 @@ define([
OO_COMMAND: Store.onlyoffice.execCommand, OO_COMMAND: Store.onlyoffice.execCommand,
// Cursor // Cursor
CURSOR_COMMAND: Store.cursor.execCommand, CURSOR_COMMAND: Store.cursor.execCommand,
// Mailbox
MAILBOX_COMMAND: Store.mailbox.execCommand,
// Pad // Pad
SEND_PAD_MSG: Store.sendPadMsg, SEND_PAD_MSG: Store.sendPadMsg,
JOIN_PAD: Store.joinPad, JOIN_PAD: Store.joinPad,

Loading…
Cancel
Save