UNPKG

@spartacus/core

Version:

Spartacus - the core framework

29 lines (28 loc) 1.16 kB
import { OnDestroy, Type } from '@angular/core'; import { Observable, Subscription } from 'rxjs'; import { EventService } from '../../event/event.service'; import { CxEvent } from '../../event/cx-event'; import * as i0 from "@angular/core"; export declare type QueryNotifier = Observable<unknown> | Type<CxEvent>; export interface QueryState<T> { loading: boolean; error: false | Error; data: T | undefined; } export interface Query<T, P extends unknown[] = []> { get(...params: P): Observable<T | undefined>; getState(...params: P): Observable<QueryState<T>>; } export declare class QueryService implements OnDestroy { protected eventService: EventService; protected subscriptions: Subscription; constructor(eventService: EventService); create<T>(loaderFactory: () => Observable<T>, options?: { reloadOn?: QueryNotifier[]; resetOn?: QueryNotifier[]; }): Query<T>; protected getTriggersStream(triggers: QueryNotifier[]): Observable<unknown>; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<QueryService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<QueryService>; }