
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
vue-crontab
Advanced tools
Periodic processing management system (crontab) running on Vue.js
VueCrontab is a plug-in for Vue.js that executes functions according to a specified schedule. The schedule consists of hours, minutes, seconds, days of the week, etc. VueCrontab executes the specified function when it matches the date and time. By using this you can easily implement periodic processing to run in the background.
$ npm install vue-crontab
Counter updated every second.
import Vue from 'vue'
import VueCrontab from 'vue-crontab'
Vue.use(VueCrontab)
new Vue({
el: '#app',
render: h => h(App)
})
<template>
<div id="app">
<div>
<div class="counter">{{ counter }}</div>
</div>
</div>
</template>
<script>
export default {
data () {
return {
counter: 0
}
},
created () {
let result = this.$crontab.addJob({
name: 'counter',
interval: {
seconds: '/1',
},
job: this.countUp
})
},
methods: {
countUp () {
this.counter += 1
}
}
}
</script>
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 |
call setOption before Vue.use() method.
VueCrontab.setOption({
interval: 100,
auto_start: false
})
Vue.use(VueCrontab)
name | argument | description |
---|---|---|
addJob | Array or Object | |
enableJob | string | Enable job with specified name. |
disableJob | string | Disable job with specified name. |
deleteJob | string | Delete job with specified name. |
execJob | string | Manually execute the job with the specified name. |
startCrontab | - | Stop the periodic processing of VueCrontab. |
stopCrontab | - | Start the periodic processing of VueCrontab. |
setOption | Object | change option of VueCrontab. |
getOption | - | get option of VueCrontab. |
name | type | description |
---|---|---|
name (required) | String | job name. |
interval (required) | Array or String or Object | Specify the periodical execution interval of the job. |
job (required) | Array or Function | Specify the function you want to execute when matching the interval. |
sync | number | Whether to synchronize and execute when multiple jobs are registered. 1 = sync, 0 = not sync(default) |
condition | Array or Function | Add a function when you want to additionally specify job execution conditions in addition to interval. The condition must return Boolean type. |
name | range | default |
---|---|---|
milliseconds | 0 - 9 | * |
seconds | 0 - 59 | * |
minutes | 0 - 59 | * |
hours | 0 - 23 | * |
day | 1 - 31 | * |
month | 1 - 12 | * |
year | 0 - | * |
week | 0 - 6 (// Sunday is 0, Monday is 1, and so on.) | * |
name | description | examples |
---|---|---|
* | All ranges | * |
/ | Number divided by 0 | /2 = every 2 seconds. /5 = every 5 seconds. |
- | Within the specified numerical range | 0-10 = between 0 and 10 seconds. |
, | Used to connect conditions | 0,1,2 ... 0,10-20,/7 ... |
execute every 0.1 seconds
{milliseconds: '/1'}
If you want to process with milliseconds, change setOption as well.
VueCrontab.setOption({
interval: 100
})
execute every minute.
{minutes: '/1'}
execute 0 minutes from 0 to 9 o'clock on the 1st of every month.
{seconds: '0', minutes:'0', hours: '0-9', day: '1'}
1,3,5,10-15 o'clock Monday
{week: '0', seconds: '0', minutes:'0', hours: '1,3,5,10-15'}
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. |
methods: {
countUp ({exec_date, last_run, counter, last_result, type}) {
return "as the next last_result.";
}
}
FAQs
Periodic processing management system (crontab) running on Vue.js
The npm package vue-crontab receives a total of 429 weekly downloads. As such, vue-crontab popularity was classified as not popular.
We found that vue-crontab demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.