call the requestFinished hook in the new request handling code - for plugins that need it
also make a request to hook something that doesn't exist a non-fatal error - to reduce plugin breakage for removed hooks
This commit is contained in:
parent
c1b338d86b
commit
ffd0258a7c
@ -43,7 +43,8 @@
|
|||||||
// array [GUID, time, details]. Plugin can manipulate the
|
// array [GUID, time, details]. Plugin can manipulate the
|
||||||
// array to change order or add additional values to the
|
// array to change order or add additional values to the
|
||||||
// details of a portal.
|
// details of a portal.
|
||||||
// requestFinished: called after each request finished. Argument is
|
// requestFinished: DEPRECATED: best to use mapDataRefreshEnd instead
|
||||||
|
// called after each map data 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
|
// iitcLoaded: called after IITC and all plugins loaded
|
||||||
|
|
||||||
@ -72,7 +73,11 @@ window.runHooks = function(event, data) {
|
|||||||
|
|
||||||
|
|
||||||
window.addHook = function(event, callback) {
|
window.addHook = function(event, callback) {
|
||||||
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);
|
if(VALID_HOOKS.indexOf(event) === -1) {
|
||||||
|
console.error('addHook: Unknown event type: ' + event + ' - ignoring');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(typeof callback !== 'function') throw('Callback must be a function.');
|
if(typeof callback !== 'function') throw('Callback must be a function.');
|
||||||
|
|
||||||
if(!_hooks[event])
|
if(!_hooks[event])
|
||||||
|
@ -368,6 +368,9 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success)
|
|||||||
var id = tiles[i];
|
var id = tiles[i];
|
||||||
this.requeueTile(id, true);
|
this.requeueTile(id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.runHooks('requestFinished', {success: false});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// TODO: use result.minLevelOfDetail ??? stock site doesn't use it yet...
|
// TODO: use result.minLevelOfDetail ??? stock site doesn't use it yet...
|
||||||
@ -407,6 +410,8 @@ window.MapDataRequest.prototype.handleResponse = function (data, tiles, success)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.runHooks('requestFinished', {success: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.processRequestQueue();
|
this.processRequestQueue();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user