⏳ A job scheduler with elegant syntax.
🚧 Project currently is still in development. Documentation and more features will be delivered soon!
You can install minuette using Yarn:
yarn add minuette
or NPM:
npm i minuette
Public
Creates a new instance of minuette. Can be called as a regular function. Note that minuette sets date and time relative to your system date/time parameters.
Sets a Job destination date using given day of week or date.
- {string} dateOrDay – timer destination date or day of week
Sets a time to run action.
- {string} time – destination time in 24 or 12-hour format
- {function} action – function to execute
- {any[]?} [args = []] – arguments to call function with
- {any?} [ctx = null] – "this" context to set to the function
Minimal example of usage:
import minuette from "minuette"
// Will execute given functinon at next nearest friday at 21 hour.
minuette().once("friday").at("9pm").do(() => console.log("Hello, world!"))
An example with absolute date:
import minuette from "minuette"
// Will execute given action at next 31 Oct, in 23:00
minuette().once("31 Oct").at("23:00").do(() => console.log("Boooo!"))
You can optionally omit setting of a date or time. In this case, minuette will use current date or time.
For example:
import minuette from "minuette"
// Will execute this action in same day as `new Date()`
minuette().at("10pm").do(() => console.log("This message appears in 22 hour"))
- Parsers for days of week, date and time (both for 12h and 24h formats);
-
.once()
,.at()
and.do()
methods for proof-of-concept implementation; - Minimal implementation for Job that supports big idle intervals for setTimeout;
-
.repeat()
and.each()
methods + supports of executing actions many times - Documentation (in progress)
- Method
.in()
that will support alternative time or date setting relative toDate.now()
- Additional public API for Job: Methods
.pause()
,.resume()
,.stop()
and.reset()