UNPKG

@pscoped/ngx-pub-sub

Version:

Event publish - subscribe mechanism as Angular service using Observable. You can publish your event along with any data to all the subscribers of your event. This library also supports historical published values for the subscribers.

30 lines 1.52 kB
import { OnDestroy } from '@angular/core'; import { Observable } from 'rxjs/internal/Observable'; import { Subscription } from 'rxjs/internal/Subscription'; import { SchedulerLike } from 'rxjs/internal/types'; import * as i0 from "@angular/core"; export declare class NgxPubSubService implements OnDestroy { private eventObservableMapping; constructor(); publishEvent(eventName: string, data?: any): void; subscribe(eventName: string, next?: (value: any) => void, error?: (error: any) => any, complete?: () => void): Subscription; /** * Use this method to get the Observable associated with the event. * Useful when you would like to apply additional rxjs operators like debounceTime */ getEventObservable(eventName: string): Observable<any>; registerEventWithLastValue(name: string, defaultValue: any): void; registerEventWithHistory(name: string, bufferSize?: number, windowTime?: number, scheduler?: SchedulerLike): void; publishWithLast(eventName: string, data?: any): void; publishWithHistory(eventName: string, data?: any): void; completeEvent(eventName: string): void; ngOnDestroy(): void; private publishNext; private checkEventType; private createSubjectIfNotExist; private validateEventName; private completeObservableAndDestroyMapping; static ɵfac: i0.ɵɵFactoryDeclaration<NgxPubSubService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NgxPubSubService>; } //# sourceMappingURL=ngx-pub-sub.service.d.ts.map