import { EventEmitter } from 'events' ; export class MyEventBus extends EventEmitter { public emit ( event , ... args ) { let argsClone = Object . assign ( [ ] , args ) ; super . emit ( event , ... argsClone ) ; let eventNamespace = event . toString ( ) . split ( ":" ) [ 0 ] ; if ( eventNamespace ) { argsClone = Object . assign ( [ ] , args ) ; argsClone . push ( event ) ; super . emit ( `${ eventNamespace }:*` , ... argsClone ) ; } return true ; } } let eventBus = new MyEventBus ( ) ; export default eventBus ;