mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
record_detail autoupdate
This commit is contained in:
1 parent
3a90e2893f
commit
c68953c59f
17 files changed
+209
-278
No files matched your search
@@ -0,0 +1,15 @@
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
const bus = new EventEmitter();
|
||||
module.exports = {
|
||||
subscribe(events, handler) {
|
||||
for (let event of events)
|
||||
bus.on(event, handler);
|
||||
},
|
||||
unsubscribe(events, handler) {
|
||||
for (let event of events)
|
||||
bus.off(event, handler);
|
||||
},
|
||||
publish(event, data) {
|
||||
bus.emit(event, { value: data, event });
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user