UNPKG

@logo-software/timer

Version:

Timer helps developer to set a specific time for their web apps and doSomething after completed.

71 lines (70 loc) 1.86 kB
import { Subject } from 'rxjs'; import { Lang } from './lang'; /** * Timer service lets developers to control timer variables on the go. */ export declare class TimerService { /** * The variable that the counter starts or ends to count or countdown. Number based variable must be in milliseconds. */ timerCount: number; /** * Set timer as counter or countdown clock. */ countdown: boolean; /** * Refactored version of the timerCount variable. Library turns milliseconds to readable format in days, hours, minutes and seconds. */ readableTime: string; /** * If countdown is false, end time will be setted. */ endTime: number; /** * Language details for localization. */ language: Lang; /** * Pause time in milliseconds if timer is paused. */ pausedTime: number; /** * First value of the timer before has been started. */ timerValue: number; /** * Global auto start option that will change on the fly. */ autoStart: boolean; isEnded: Subject<boolean>; private timer; /** * Prepare the timer values and if autoStart option is true, starts the timer. */ prepareTimer(): void; /** * Run timer function which will starts timer with setted values */ runTimer(): void; /** * Pause the timer. */ pauseTimer(): void; /** * Resume the paused timer. If the timer isn't paused, resume function will not be worked. */ resumeTimer(): void; /** * Sets the timer end point and stops the timer. */ stopTimer(): void; /** * Revert the timer to the start value */ resetTimer(): void; /** * Sets the timer clock. Value must be in milliseconds. * @param ms:number */ setTime(ms: number): void; }