UNPKG

angular7-pubsub

Version:
59 lines (58 loc) 3.36 kB
import { Observable, Subscription } from 'rxjs'; import * as i0 from "@angular/core"; export declare class PubSubService implements IPubSubService { private events; constructor(); /** * a subscription which returns everything as an observable from @see {RxJs} * this method does not use eventObject * @param {event} event - the specific name to subscribe on - the names must be specific to those we publish. * @returns {Observable<any>} an observable. * @summary remember to unsubscribe in onDestroy of the components */ $sub(event: string): Observable<any>; /** * a subscription which returns the callback, error and complete as a subscription from @see {RxJs} * this method does not use eventObject * @param {event} event - the specific name to subscribe on - the names must be specific to those we publish. * @param {(value: any) => void} callback - callback method which gets the value from eventObject. * @returns {Subscription} a subscription which we can listen to. * @summary remember to unsubscribe in onDestroy of the components */ $sub(event: string, callback: (value: any) => void): Subscription; /** * a subscription which returns the callback, error and complete as a subscription from @see {RxJs} * this method does not use eventObject * @param {event} event - the specific name to subscribe on - the names must be specific to those we publish. * @param {(error: any) => void} error - exception catch function * @param {() => void} complete - complete function * @returns {Subscription} a subscription which we can listen to. * @summary remember to unsubscribe in onDestroy of the components */ $sub(event: string, callback: (value: any) => void, error: (error: any) => void): Subscription; /** * a subscription which returns the callback, error and complete as a subscription from @see {RxJs} * @param {event} event - the specific name to subscribe on - the names must be specific to those we publish. * @param {(value: any) => void} callback - callback function * @param {(error: any) => void} error - exception catch function * @param {() => void} complete - complete function * @returns {Subscription} a subscription which we can listen to. * @summary remember to unsubscribe in onDestroy of the components */ $sub(event: string, callback: (value: any) => void, error: (error: any) => void, complete: () => void): Subscription; /** * Base Module needed to use PubSubService. * @param {event} event - the specific name to subscribe on * @param {eventObject} eventObject - the optional paramter to send when raising the event */ $pub(event: string, eventObject?: any): void; static ɵfac: i0.ɵɵFactoryDeclaration<PubSubService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<PubSubService>; } export interface IPubSubService { $pub(event: string, eventObject?: any): void; $sub(event: string): Observable<any>; $sub(event: string, callback: (value: any) => void): Subscription; $sub(event: string, callback: (value: any) => void, error: (error: any) => void): Subscription; $sub(event: string, callback: (value: any) => void, error: (error: any) => void, complete: () => void): Subscription; }