// Import the Pausable class
import Pausable from './Pausable';
// Define an async function to be executed in a loop
async function loopFunction() {
console.log('Looping...');
await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second
}
// Create an instance of the Pausable class with the loopFunction
const pausableLoop = new Pausable(loopFunction);
// Start the pausable loop
pausableLoop.start();
// After 5 seconds, stop the pausable loop
setTimeout(() => {
pausableLoop.stop();
console.log('Pausable loop stopped.');
}, 5000);-
Notifications
You must be signed in to change notification settings - Fork 0
License
undefjs/Pausable
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published