1.0.1 • Published 5 years ago
instapublish v1.0.1
Minimalistic JS callback scheduler 🛵
Pure JS, no dependencies.
Installation
yarn add minicallQuick start
import minicall from 'minicall'
const task = new minicall({
timeSlot: [12 * 3600, 20 * 3600], //trigger the onReachedCallback every day, at 12 noon and 20pm
onReached: async () => await someSendingFunction('Hey this message has been sent from a scheduled task!'),
onRunned: () => console.log('onReached has been called 🎉'),
})
task.start()
/* task.stop() */ScheduledTask
Options:
Name Type Description Default Required timeSlot number[] or numberIf an array, it has to be an Array of secondsof a day where theonReachedcallback is going to be called at. If it's a number the callback is going to be called at everytimeSlotvalue10,000(10 seconds)NO onReached (daySecond: number) => anyCallback called when the seconds of the day reach reach one of the targets set in timeSlotundefinedYES onRunned () => anyCallback called when onReached has been called () => nullNO