2021-12-10 02:37:01 +00:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google LLC All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
2024-09-20 15:23:15 +00:00
|
|
|
* found in the LICENSE file at https://angular.dev/license
|
2021-12-10 02:37:01 +00:00
|
|
|
*/
|
|
|
|
|
|
2021-12-09 05:44:17 +00:00
|
|
|
export type Parameters<F> = F extends (...args: infer T) => any ? T : never;
|
2020-01-27 18:40:18 +00:00
|
|
|
|
|
|
|
|
export abstract class MessageBus<T> {
|
|
|
|
|
abstract on<E extends keyof T>(topic: E, cb: T[E]): void;
|
|
|
|
|
abstract once<E extends keyof T>(topic: E, cb: T[E]): void;
|
2020-03-23 23:35:02 +00:00
|
|
|
abstract emit<E extends keyof T>(topic: E, args?: Parameters<T[E]>): boolean;
|
2020-01-27 18:40:18 +00:00
|
|
|
abstract destroy(): void;
|
|
|
|
|
}
|