From 44878bc0a30c23f155347dc915a29a327069bd95 Mon Sep 17 00:00:00 2001 From: Mark Holmquist Date: Wed, 8 Aug 2012 10:37:16 -0700 Subject: [PATCH] Add in a plugin hook "handleClientMessage_" The new hook will accept only the message named in the hook call. It will be used primarily for adding new message handlers, but it can alse be used to handle existing message types. --- src/static/js/collab_client.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index 437942c8..7e984710 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -21,6 +21,7 @@ */ var chat = require('./chat').chat; +var hooks = require('./pluginfw/hooks'); // Dependency fill on init. This exists for `pad.socket` only. // TODO: bind directly to the socket. @@ -337,6 +338,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) { callbacks.onServerMessage(msg.payload); } + hooks.callAll('handleClientMessage_' + msg.type, {payload: msg.payload}); } function updateUserInfo(userInfo)