Profile refactoring with friend request
This commit is contained in:
@@ -168,6 +168,31 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
// Universal direct channel
|
||||
var modules = {};
|
||||
funcs.makeUniversal = function (type, cfg) {
|
||||
if (modules[type]) { return; }
|
||||
var sframeChan = funcs.getSframeChannel();
|
||||
modules[type] = {
|
||||
onEvent: cfg.onEvent || function () {}
|
||||
};
|
||||
return {
|
||||
execCommand: function (cmd, data, cb) {
|
||||
sframeChan.query("Q_UNIVERSAL_COMMAND", {
|
||||
type: type,
|
||||
data: {
|
||||
cmd: cmd,
|
||||
data: data
|
||||
}
|
||||
}, function (err, obj) {
|
||||
if (err) { return void cb({error: err}); }
|
||||
cb(obj);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Chat
|
||||
var padChatChannel;
|
||||
// common-ui-elements needs to be able to get the chat channel to put it in metadata when
|
||||
@@ -575,6 +600,12 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
ctx.sframeChan.on('EV_UNIVERSAL_EVENT', function (obj) {
|
||||
var type = obj.type;
|
||||
if (!type || !modules[type]) { return; }
|
||||
modules[type].onEvent(obj.data);
|
||||
});
|
||||
|
||||
ctx.metadataMgr.onReady(waitFor());
|
||||
|
||||
funcs.addShortcuts();
|
||||
|
||||
Reference in New Issue
Block a user