src/modules/progress-indicator/services/progress-indicator.service.intf.ts
Service to handle the visibility of a progress indicator (e.g., spinner, progress percentage, ...) programmatically.
Methods |
deregister | ||||||||
deregister(topic: string)
|
||||||||
Deregisters a progress indicator already existing in the application state.
Parameters :
Returns :
void
|
hide | ||||||||
hide(topic: string)
|
||||||||
Hides the progress indicator.
Parameters :
Returns :
void
|
isVisible | ||||||||
isVisible(topic: string)
|
||||||||
Returns the latest status of the progress indicator for the given topic (whether is shown or hidden).
Parameters :
Returns :
Observable<boolean | undefined>
Observable that will emit a boolean value whenever the status of the progress indicator changes: |
register | ||||||||||||
register(topic: string, type: StarkProgressIndicatorType)
|
||||||||||||
Registers a new progress indicator in the application state. Each registered progress indicator is identified by a topic, a unique identifier associated with it.
Parameters :
Returns :
void
|
show | ||||||||
show(topic: string)
|
||||||||
Shows the designated progress indicator
Parameters :
Returns :
void
|
import { Observable } from "rxjs";
import { StarkProgressIndicatorType } from "../entities";
import { InjectionToken } from "@angular/core";
/**
* @ignore
*/
export const starkProgressIndicatorServiceName = "StarkProgressIndicatorService";
/**
* {@link https://v12.angular.io/api/core/InjectionToken|InjectionToken} used to provide the {@link StarkProgressIndicatorService}
*/
export const STARK_PROGRESS_INDICATOR_SERVICE: InjectionToken<StarkProgressIndicatorService> =
new InjectionToken<StarkProgressIndicatorService>(starkProgressIndicatorServiceName);
/**
* Service to handle the visibility of a progress indicator (e.g., spinner, progress percentage, ...) programmatically.
*/
export interface StarkProgressIndicatorService {
/**
* Registers a new progress indicator in the application state. Each registered progress indicator is identified by a topic,
* a unique identifier associated with it.
* @param topic - The topic of the progress indicator to be registered.
* @param type - Type of progress indicator (i.e. spinner)
*/
register(topic: string, type: StarkProgressIndicatorType): void;
/**
* Deregisters a progress indicator already existing in the application state.
* @param topic - The topic of the progress indicator to be deregistered
*/
deregister(topic: string): void;
/**
* Shows the designated progress indicator
* @param topic - The topic that needs to be shown
*/
show(topic: string): void;
/**
* Hides the progress indicator.
* @param topic - The topic that needs to be hidden
*/
hide(topic: string): void;
/**
* Returns the latest status of the progress indicator for the given topic (whether is shown or hidden).
* @param topic - The topic of the progress indicator whose status will be fetched.
* @returns Observable that will emit a boolean value whenever the status of the progress indicator changes: `false` if it is hidden,
* `true` if it is shown or `undefined` in case there is no progress indicator for the given topic.
*/
isVisible(topic: string): Observable<boolean | undefined>;
}