import {
setIntervalTimeFn,
clearIntervalTimeFn,
} from "@jagi/set-interval-time-fn";
const start = Date.now();
const timerId = setIntervalTimeFn(
() => {
console.log(`${Date.now() - start} ms elapsed`);
},
time => {
// Start interval from 1 second and increase it by 1 second on each execution.
return !time ? 1000 : time + 1000;
},
);
setTimeout(() => {
clearIntervalTimeFn(timerId);
}, 10 * 1000); // Clear interval after 20 seconds.
-
Notifications
You must be signed in to change notification settings - Fork 0
jagi/set-interval-time-fn
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published