Don't request data if previous request has not yet been successful

This commit is contained in:
John Furrow
2016-03-19 15:11:02 +01:00
parent 1a9b595f47
commit 3a92286d71
3 changed files with 95 additions and 52 deletions

View File

@@ -6,17 +6,34 @@ export default class BaseStore extends EventEmitter {
this.dispatcherID = null;
this.on('uncaughtException', this.handleError);
this.requests = {};
this.setMaxListeners(20);
}
beginRequest(id) {
this.requests[id] = true;
}
handleError(error) {
console.trace(error);
}
isRequestPending(id) {
if (this.requests[id] == null || this.requests[id] === false) {
return false;
}
return true;
}
listen(event, callback) {
this.on(event, callback);
}
resolveRequest(id) {
this.requests[id] = false;
}
unlisten(event, callback) {
this.removeListener(event, callback);
}