UNPKG

@studiohyperdrive/ngx-auth

Version:

A library of core authentication functionality used with @studiohyperdrive/types-auth.

44 lines (43 loc) 1.69 kB
import { ChangeDetectorRef, OnDestroy, PipeTransform } from '@angular/core'; import { NgxAuthenticationAbstractService } from '../../abstracts'; import * as i0 from "@angular/core"; /** * A pipe that returns whether a (list of) feature(s) has been provided */ export declare class NgxHasFeaturePipe<FeatureType extends string> implements PipeTransform, OnDestroy { private readonly authenticationService; private readonly cdRef; /** * Subject to hold the destroyed state of the current observable */ private destroyed$; /** * The latest value of the Observable, whether or not the feature is provided */ private hasFeature; /** * Instance of the change detector ref, implemented like this according to the async pipe implementation * https://github.com/angular/angular/blob/main/packages/common/src/pipes/async_pipe.ts */ private changeDetectorRef; constructor(authenticationService: NgxAuthenticationAbstractService, cdRef: ChangeDetectorRef); ngOnDestroy(): void; /** * Returns whether or not a feature is provided for the environment * * @param feature - The provided feature */ transform(feature: FeatureType | FeatureType[]): boolean; /** * Handles the changeDetection, latest value and dispose of the hasFeature observable * * @param observable - The hasFeature observable */ private subscribe; /** * Dispose of the feature observable when existing */ private dispose; static ɵfac: i0.ɵɵFactoryDeclaration<NgxHasFeaturePipe<any>, never>; static ɵpipe: i0.ɵɵPipeDeclaration<NgxHasFeaturePipe<any>, "ngxHasFeature", true>; }