- 
                Notifications
    You must be signed in to change notification settings 
- Fork 116
Open
Description
Hello,
First of all thanks a lot for the lib and your continuous work on it
It would be highly valuable for my project to be able to handle a dynamic number of timers (dynamicity making it incompatible with calling useTimer n-times)
The API could look like this:
export function useMultipleTimers(settings: TimerSettings): TimerResult
interface TimerSettings {
    // no expiryTimestamp: it MUST be defined at runtime (start or restart), making start & restart identical functions
    onExpire?: (timerId) => void;
}
interface TimerResult {
    getRemainingTime: (timerId: string) => {
        seconds: number;
        minutes: number;
        hours: number;
        days: number;
    };
    getIsRunning: (timerId: string) => boolean;
    start: (timerId: string, newExpiryTimestamp: Date, autoStart?: boolean) => void;
    pause: (timerId: string) => void;
    resume: (timerId: string) => void;
}I could give it a go implementing it, but I am looking forward for your opinion beforehand ;)
Thanks!
Metadata
Metadata
Assignees
Labels
No labels