trillion-widget
Version:
Trillion AR Widget
10 lines (9 loc) • 438 B
TypeScript
export interface IEvent<DataType> {
subscribe(callback: (data: DataType) => void): void;
unsubscribe(callback: (data: DataType) => void): void;
}
export interface INotifier<DataType> {
notify(data: DataType): void;
}
export declare function produceObserver<DataType>(): IEvent<DataType> & INotifier<DataType>;
export declare function once<DataType>(observer: IEvent<DataType>, callback: (data: DataType) => void): () => void;