1.0.2 • Published 2 years ago
@splitscript.js/scheduler v1.0.2

Package for scheduling events
About
This package is part of SplitScript.js, the everything framework
It is used for scheduling events
Install
$ npm i '@splitscript.js/scheduler'Usage
Times
| unit | ms | s |
|---|---|---|
| s | 1,000 | 1 |
| m | 60,000 | 60 |
| h | 3,600,000 | 3,600 |
| d | 86,400,000 | 86,400 |
E.g 10m would mean 600 seconds or 600,000 ms
You can also use decimals, so 0.5m would be half a minute, or 30 seconds
⚠ There is a maximum of
2,147,483,647ms
Start scheduling
import scheduler from '@splitscript.js/scheduler'
scheduler.start()Create a scheduler
Create a file in your functions/scheduler folder like...
functions/
scheduler/
0.5m - 30 seconds
1s - every second
1h - hourly
1d - dailyAnd export a function:
export default function () {
console.log('this is a scheduled event')
}
// or
module.exports = async function () {
console.log('this is a scheduled event')
}Schedule once
import scheduler from '@splitscript.js/scheduler'
scheduler.schedule(time, () => {
// do someting
})For more, go to the docs
v1.0.2 | by ultraviolet