Periodic processing management system (crontab) running on Vue.js
npm install vue-crontab
$ npm install vue-crontab
`
Examples
- Simple vue component
- Multi jobs
- Use with the Vuex
- Additional condition of the function.
- Async of the functions
Usage
Counter updated every second.
`javascript
import Vue from 'vue'
import VueCrontab from 'vue-crontab'
Vue.use(VueCrontab)
new Vue({
el: '#app',
render: h => h(App)
})
`
`javascript
{{ counter }}
`
Reference
$3
#### option
| name | type | description | default |
| ------------- | ------------- | ------------- | ------------- |
| interval | number | The interval to check the interval of the managed job.(milliseconds) | 1000 |
| auto_start | Boolean | Setting whether to automatically move cron when one or more jobs are reached. | true |
#### examples
call setOption before Vue.use() method.
`javascript
VueCrontab.setOption({
interval: 100,
auto_start: false
})
Vue.use(VueCrontab)
`
#### methods
| name | argument | description |
| ------------- | ------------- | ------------- |
| addJob | Array`javascript
{milliseconds: '/1'}
`
> If you want to process with milliseconds, change setOption as well.
`javascript
VueCrontab.setOption({
interval: 100
})
`
execute every minute.
`javascript
{minutes: '/1'}
`
execute 0 minutes from 0 to 9 o'clock on the 1st of every month.
`javascript
{seconds: '0', minutes:'0', hours: '0-9', day: '1'}
`
1,3,5,10-15 o'clock Monday
`javascript
{week: '0', seconds: '0', minutes:'0', hours: '1,3,5,10-15'}
`
#### job arguments
| name | type | description |
| ------------- | ------------- | ------------- |
| exec_date | Date | Match date and time. |
| last_run | Date | Last execution date and time. |
| counter | number | Number of executions. |
| last_result | any | Return value of the previous function. |
| type | String | 'cron' = executed by periodic processing. 'manual = manually execution. |
`javascript
methods: {
countUp ({exec_date, last_run, counter, last_result, type}) {
return "as the next last_result.";
}
}
``