@splitscript.js/scheduler
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Package for scheduling events

install size downloads

docs

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 - daily

And 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

Package Sidebar

Install

npm i @splitscript.js/scheduler

Weekly Downloads

10

Version

1.0.2

License

MIT

Unpacked Size

11.4 kB

Total Files

11

Last publish

Collaborators

  • infrareddevs