Skip to content

Commit

Permalink
Fix event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvaner committed Nov 23, 2019
1 parent 19b539b commit 97459f4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/libs/EventsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,23 @@ export default {
this.Communication = Communication;
},
/**
* Call getNewEvents in background
* Start event loop
*/
loop() {
if (!this.store.getters.isEventsManagerStarted()) {
this.store.commit("setEventsManagerState", true);
let self = this;
setTimeout(function() {
self.getNewEvents();
}, 1);
this.execute();
}
},
/**
* Event loop execution
*/
execute() {
let self = this;
setTimeout(function() {
self.getNewEvents();
}, 1);
},
/**
* Get new events since last call
*/
Expand Down Expand Up @@ -67,6 +73,6 @@ export default {
});
}
});
this.loop();
this.execute();
}
};

0 comments on commit 97459f4

Please sign in to comment.