@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
73 lines • 2.95 kB
TypeScript
import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import * as i0 from "@angular/core";
/**
* Component to count down specific time interval, then emit when countdown ends.
* Next countdown is started right after previous one.
*/
export declare class CountdownIntervalComponent implements OnInit, OnDestroy {
/**
* Time in milliseconds to count down from.
*/
set countdownInterval(value: number);
get countdownInterval(): number;
/**
* Emits when countdown ends.
*/
countdownEnded: EventEmitter<void>;
runSpinner$: BehaviorSubject<boolean>;
secondsUntilRefresh$: BehaviorSubject<string>;
private _countdownInterval;
private destroy$;
private readonly MINIMUM_INTERVAL;
private readonly ONE_SECOND;
private start$;
private countdownSubscription;
ngOnInit(): void;
ngOnDestroy(): void;
/**
* Starts the countdown timer.
*/
start(): void;
/**
* Stops the countdown timer.
* @param stopAtZero - If true, stops the timer when it reaches zero. Otherwise, stops it at the current countdown interval.
*/
stop(stopAtZero?: boolean): void;
reset(): void;
/**
* Initializes the countdown timer.
* Kicks off the timer logic and activates any associated UI elements.
*/
private initializeCountdownInterval;
/**
* Creates an Observable stream that emits events when the document's visibility changes.
* @returns An Observable emitting `null` whenever the visibility of the document changes.
*/
private createDocumentHiddenEventStream;
/**
* Creates the main interval Observable for the countdown timer.
* @param timerStart$ - A Subject to signal the start of the timer.
* @param documentHiddenEvent$ - An Observable for document visibility changes.
* @returns An Observable that orchestrates the timer logic.
*/
private createIntervalStream;
/**
* Creates a timer Observable that emits every second.
* @returns An Observable that emits a number every second, starting from 0.
*/
private createTimer;
/**
* Updates the remaining time in the countdown.
* @param value - The current timer value in seconds.
*/
private updateRemainingTime;
/**
* Subscribes to the interval Observable and sets up the event handlers for the countdown.
* @param interval$ - The countdown interval Observable to subscribe to.
*/
private subscribeToInterval;
static ɵfac: i0.ɵɵFactoryDeclaration<CountdownIntervalComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CountdownIntervalComponent, "c8y-countdown-interval", never, { "countdownInterval": { "alias": "countdownInterval"; "required": false; }; }, { "countdownEnded": "countdownEnded"; }, never, never, true, never>;
}
//# sourceMappingURL=countdown-interval.component.d.ts.map