schedules
v1.0.3
Published
```js const Scheduler = require('schedules'); const Sch = new Scheduler("MONGO_DB_URI_GOES_HERE"); ;(async() => { await Sch.start(); await Sch.schedule(Date.now() + 5000, { hi: "test" }); console.log(await Sch.findTimestampEnded(Date.now() + 2000))
Downloads
5
Readme
const Scheduler = require('schedules');
const Sch = new Scheduler("MONGO_DB_URI_GOES_HERE");
;(async() => {
await Sch.start();
await Sch.schedule(Date.now() + 5000, { hi: "test" });
console.log(await Sch.findTimestampEnded(Date.now() + 2000)) // [];
console.log(await Sch.findTimestampEnded(Date.now() + 2000)) // [{ Data: {...}}];
// The system above allows you to check for schedules that would've ended before that timestamp.
Sch.on('data', console.log); // Will log the data so when the schedule for the one above ends it'd log { hi: "test" } and how many ms after the system was supposed to end that the db picked it up
await Sch.deleteSchedules(); // Removes all schedules
})();