Add 'iitcLoaded' hook to notify that IITC and all plugins loaded.

This commit is contained in:
Xelio 2013-05-08 20:47:41 +08:00
parent 13d1ff9aaa
commit 6cd3328389
2 changed files with 3 additions and 2 deletions

View File

@ -431,6 +431,7 @@ function boot() {
setTimeout('window.map.invalidateSize(false);', 500); setTimeout('window.map.invalidateSize(false);', 500);
window.iitcLoaded = true; window.iitcLoaded = true;
window.runHooks('iitcLoaded');
} }
// this is the minified load.js script that allows us to easily load // this is the minified load.js script that allows us to easily load

View File

@ -53,14 +53,14 @@
// set reached to true. // set reached to true.
// requestFinished: called after each request finished. Argument is // requestFinished: called after each request finished. Argument is
// {success: boolean} indicated the request success or fail. // {success: boolean} indicated the request success or fail.
// iitcLoaded: called after IITC and all plugins loaded
window._hooks = {} window._hooks = {}
window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated', window.VALID_HOOKS = ['portalAdded', 'portalDetailsUpdated',
'publicChatDataAvailable', 'factionChatDataAvailable', 'portalDataLoaded', 'publicChatDataAvailable', 'factionChatDataAvailable', 'portalDataLoaded',
'beforePortalReRender', 'checkRenderLimit', 'requestFinished', 'nicknameClicked', 'beforePortalReRender', 'checkRenderLimit', 'requestFinished', 'nicknameClicked',
'geoSearch']; 'geoSearch', 'iitcLoaded'];
window.runHooks = function(event, data) { window.runHooks = function(event, data) {
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event); if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);