datadavev / DwC_views

Implements viewers for Darwin Core record repositories
1 stars 0 forks source link

DwC JQuery Client - Map View: Cancel/Abort Ajax Calls #48

Closed coreyo closed 13 years ago

coreyo commented 13 years ago

The map can perform dynamic tiling/querying when the user pans and zooms. If the user makes several successive pans and zooms, one query may be requested before the previous one is finished. In this case, the previous queries become irrelevant and we only care about the latest query. We want to cancel the previous query (and corresponding callback function) in order to speed up the current request.

coreyo commented 13 years ago

We can use the .abort() function from any ajax call (i.e. .ajax(), .getJSON(), and .getXML()) like so:

var ajax_handler = $.getJSON(url, callback); ajax_handler.abort()

coreyo commented 13 years ago

Abortion for single tile queries has been implemented and is working in the latest sandbox. For loading of multiple tiles, we will need to implement an array of active ajax connection handlers which should all be aborted in the case a new active total area.

coreyo commented 13 years ago

This has been implemented as well as intended. The initial, map-wide query will never be aborted. However, all dynamic queries will be aborted as soon as the active bounds changes. Closing this ticket.