15 lines
467 B
TypeScript
15 lines
467 B
TypeScript
export declare type ObserverCallback<T> = (data: T) => void;
|
|
export default class Observable<T = any> {
|
|
private collect;
|
|
private collect_intervall;
|
|
private subscriber;
|
|
private events;
|
|
private timeout;
|
|
constructor(collect?: boolean, collect_intervall?: number);
|
|
getPublicApi(): {
|
|
subscribe: (callback: ObserverCallback<T[]>) => void;
|
|
unsubscribe: (callback: ObserverCallback<T[]>) => void;
|
|
};
|
|
send(data: T): void;
|
|
}
|