import EventEmitter from 'events'; import {child} from './childState'; class Bus extends EventEmitter { emit(event: string, ...args: Array): boolean { if (child) { child.workerApi.callMaster( { // @ts-expect-error TS2339 location: process.browser ? '@atlaspack/workers/bus' : __filename, method: 'emit', args: [event, ...args], }, false, ); return true; } else { return super.emit(event, ...args); } } } export default new Bus() as Bus;