Screen out requests if they've already occurred.
Closed this issue · 4 comments
mroberge commented
Save data locally, and use this data instead of loading the data again.
Right now if you click on the same point twice, it will get added to the table twice, and it will download the data twice too.
mroberge commented
The Web Storage API with examples.
The basic localStorage object
mroberge commented
Detect if localStorage is available: (source)
function storageAvailable(type) {
try {
var storage = window[type],
x = '__storage_test__';
storage.setItem(x, x);
storage.removeItem(x);
return true;
}
catch(e) {
return false;
}
}
Use this function like this:
if (storageAvailable('localStorage')) {
// Yippee! We can use localStorage awesomeness
}
else {
// Too bad, no localStorage for us
}
mroberge commented
Whenever a new site is requested, so something like this:
if(!localStorage.getItem(site-id)) {
requestData();
saveToStorage();
useStorageData();
} else {
useStorageData();
}