skweb-cron
v2.0.0
Published
Cron model for skweb framework based on cron and cron-parser.
Readme
skweb-cron
Cron task manager for skweb framework.
Installation
npm install skweb-cronUsage
const { CronAction, CronTask, taskMgr } = require('skweb-cron')
// Define custom action
class MyAction extends CronAction {
async run(options, task) {
// Your task logic here
return { progress: 100 }
}
}
// Load actions
taskMgr.loadActions('./actions')
// Load tasks
await taskMgr.loadTasks([
{
id: 'task1',
cronTime: '0 * * * *',
method: 'myAction',
options: { foo: 'bar' }
}
])
// Start a task
taskMgr.startTask('task1')
// Stop a task
taskMgr.stopTask('task1')License
MIT
