add hook for chat data
This commit is contained in:
parent
4eb90976e3
commit
044b5f2147
@ -200,6 +200,8 @@ window.chat.handlePublic = function(data, textStatus, jqXHR) {
|
||||
chat.writeDataToHash(data, chat._publicData, true);
|
||||
var oldMsgsWereAdded = old !== chat.getOldestTimestamp(false);
|
||||
|
||||
runHooks('publicChatDataAvailable', {raw: data, processed: chat._publicData});
|
||||
|
||||
switch(chat.getActive()) {
|
||||
case 'public': window.chat.renderPublic(oldMsgsWereAdded); break;
|
||||
case 'compact': window.chat.renderCompact(oldMsgsWereAdded); break;
|
||||
|
@ -24,9 +24,15 @@
|
||||
// the Leaflet CircleMarker for the portal in "portal" var.
|
||||
// portalDetailsUpdated: fired after the details in the sidebar have
|
||||
// been (re-)rendered
|
||||
// publicChatDataAvailable: this hook runs after data for any of the
|
||||
// public chats has been received and processed, but not
|
||||
// yet been displayed. The data hash contains both the un-
|
||||
// processed raw ajax response as well as the processed
|
||||
// chat data that is going to be used for display.
|
||||
|
||||
window._hooks = {}
|
||||
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated'];
|
||||
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated',
|
||||
'publicChatDataAvailable'];
|
||||
|
||||
window.runHooks = function(event, data) {
|
||||
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user