mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
18 lines
300 B
JavaScript
18 lines
300 B
JavaScript
const { EventEmitter } = require('events');
|
|
|
|
const eTarget = new EventEmitter();
|
|
/**
|
|
* 事件总线
|
|
*/
|
|
module.exports = {
|
|
on: (type, fn) => {
|
|
eTarget.addListener(type, fn);
|
|
},
|
|
emit: (type) => {
|
|
eTarget.emit(type);
|
|
},
|
|
off: () => {
|
|
eTarget.off();
|
|
}
|
|
};
|