scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
47 lines (44 loc) • 1.05 kB
text/typescript
import { AbsTimer } from 'scriptable-abstract';
interface TimerState {
timeInterval: number;
repeats: boolean;
running: boolean;
}
/**
* Mock implementation of Scriptable's Timer
* Used to schedule code execution after a delay
*/
declare class MockTimer extends AbsTimer<TimerState> {
private timerId;
constructor();
/**
* Schedule a function to be called after a delay
* @param callback Function to be called
*/
schedule(callback: () => void): void;
/**
* Invalidates the timer, preventing it from firing
*/
invalidate(): void;
/**
* Whether the timer is currently running
*/
get isRunning(): boolean;
/**
* Time interval in seconds
*/
get timeInterval(): number;
/**
* Sets the time interval in seconds
*/
set timeInterval(value: number);
/**
* Whether the timer repeats
*/
get repeats(): boolean;
/**
* Sets whether the timer repeats
*/
set repeats(value: boolean);
}
export { MockTimer };