mirror of
https://github.com/zoriya/flood.git
synced 2025-12-20 06:05:15 +00:00
Don't request data if previous request has not yet been successful
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user