Nuxt Scheduler
Schedule Jobs within Nuxt 3.
Features
Quick Setup
- Add
nuxt-scheduler
dependency to your project
pnpm add -D nuxt-scheduler
yarn add --dev nuxt-scheduler
npm install --save-dev nuxt-scheduler
- Add
nuxt-scheduler
to the modules
section of nuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-scheduler'
]
})
That's it! You can now use Nuxt Scheduler in your Nuxt app ✨
Example Usage
You must create a file here
~/server/app/scheduler.ts
import { useScheduler } from "#scheduler";
export default function startScheduler() {
const scheduler = useScheduler();
scheduler.start();
scheduler.run(() => {
console.log("this should run every 5 seconds");
}).everySeconds(5);
}
Development
npm install
npm run dev:prepare
npm run dev
npm run dev:build
npm run lint
npm run test
npm run test:watch
npm run release