Merge pull request #454 from bbarao/gh-pages
New Hook: After receiving new faction messages
This commit is contained in:
commit
c5012c2d3b
@ -152,6 +152,8 @@ window.chat.handleFaction = function(data, textStatus, jqXHR) {
|
||||
chat.writeDataToHash(data, chat._factionData, false);
|
||||
var oldMsgsWereAdded = old !== chat.getOldestTimestamp(true);
|
||||
|
||||
runHooks('factionChatDataAvailable', {raw: data, processed: chat._factionData});
|
||||
|
||||
window.chat.renderFaction(oldMsgsWereAdded);
|
||||
|
||||
if(data.result.length >= CHAT_FACTION_ITEMS) chat.needMoreMessages();
|
||||
|
@ -30,6 +30,11 @@
|
||||
// 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.
|
||||
// factionChatDataAvailable: this hook runs after data for the faction
|
||||
// chat has been received and processed, but not yet been
|
||||
// displayed. The data hash contains both the unprocessed
|
||||
// raw ajax response as well as the processed chat data
|
||||
// that is going to be used for display.
|
||||
// portalDataLoaded: callback is passed the argument of
|
||||
// {portals : [portal, portal, ...]} where "portal" is the
|
||||
// data element and not the leaflet object. "portal" is an
|
||||
@ -53,8 +58,8 @@
|
||||
|
||||
window._hooks = {}
|
||||
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated',
|
||||
'publicChatDataAvailable', 'portalDataLoaded', 'beforePortalReRender',
|
||||
'checkRenderLimit', 'requestFinished'];
|
||||
'publicChatDataAvailable', 'factionChatDataAvailable', 'portalDataLoaded',
|
||||
'beforePortalReRender', 'checkRenderLimit', 'requestFinished'];
|
||||
|
||||
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