Quickstart
import { Module as EventsModule } from '@quik/events';
await EventsModule.setup({ /* bootstrap options */ });
import { QGlobalEventBus } from '@quik/events';
// Subscribe — returns an unsubscribe function
const off = QGlobalEventBus.on<{ userId: number }>('user.created', async ({ userId }) => {
console.log('New user:', userId);
});
// Emit
await QGlobalEventBus.emit('user.created', { userId: 42 });
// Unsubscribe
off();
Notes
QGlobalEventBusis a process-wide singleton; useQEventBusdirectly when you need an isolated bus.- Handler errors are caught and logged per-handler, so one failing subscriber never breaks others or the emitter.