tsbase
Version:
Base class libraries for TypeScript
39 lines (38 loc) • 1.28 kB
TypeScript
import { IConditionalTimer, Condition, Action } from './IConditionalTimer';
import { ITimer } from './ITimer';
/**
* A timer that performs an action over time based on the evaluation of a condition
*/
export declare class ConditionalTimer implements IConditionalTimer {
private timer;
constructor(timer?: ITimer);
/**
* Short hand for creating a new instance of ConditionalTimer
* @param interval
*/
static Instance(interval?: number): ConditionalTimer;
/**
* Performs the given action one time after the condition evaluates to true
* @param action
* @param condition
*/
DoWhen(action: Action, condition: Condition): Promise<void>;
/**
* Performs the given action repeatedly until the condition evaluates to true
* @param action
* @param condition
*/
DoUntil(action: Action, condition: Condition): Promise<void>;
/**
* Performs the given action repeatedly as long as the condition evaluates to true
* @param action
* @param condition
*/
DoWhile(action: Action, condition: Condition): Promise<void>;
/**
* Stops the underlying timer, preventing further execution
*/
Stop(): void;
private getRepeatingConditionalTimer;
private resetTimer;
}