(name: string, ...variableArgs: any[])
| 465 | export function notify(name: string, data: ArbitraryObject): void; |
| 466 | export function notify(name: string): void; |
| 467 | export function notify(name: string, ...variableArgs: any[]): void { |
| 468 | // quickly check if there are any possible handlers for this event |
| 469 | if (isSubscribed(name)) { |
| 470 | const descriptors = variableArgs[0] instanceof Descriptors ? variableArgs.shift() : Descriptors.none; |
| 471 | |
| 472 | // add the event to the queue |
| 473 | queue.push(expandVariableArgs(variableArgs, { name, variableArgs, descriptors })); |
| 474 | |
| 475 | // if the queue was empty, start it draining the queue |
| 476 | if (DispatcherBusy.isCompleted) { |
| 477 | void drain(); // don't wait for the queue to finish draining |
| 478 | } |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | /** immediately dispatches an event */ |
| 483 | export function notifyNow(name: string, descriptors: Descriptors, text: string): void; |
no test coverage detected