This commit is contained in:
2019-08-23 00:12:49 +02:00
committed by GitHub
parent c30e9f27a5
commit fd3a2bc24f
94 changed files with 13855 additions and 9269 deletions

View File

@@ -0,0 +1,21 @@
class Events {
constructor() {
this.listeners = [];
}
listen(fn) {
this.listeners.push(fn);
}
unlisten(fn) {
this.listeners = this.listeners(l => l !== fn);
}
publish(type, data) {
this.listeners.forEach(l => l(type, data));
}
}
const events = new Events();
export default events;