# @eggjs/schedule-decorator

> tegg schedule decorator

Latest version **4.0.2** (published 2026-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @eggjs/schedule-decorator
pnpm add @eggjs/schedule-decorator
yarn add @eggjs/schedule-decorator
bun add @eggjs/schedule-decorator
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2026-10-06 |
| First published | 2025-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18981 |
| Author | killagu |
| Maintainers | gxkl, eggjs-admin, fengmk2, atian25, hyj1991, killagu, coolme200, akitasummer, elrrrrrrr, niania |
| Keywords | egg, runtime, tegg, typescript |

## Links

- npm: https://www.npmjs.com/package/@eggjs/schedule-decorator
- Repository: https://github.com/eggjs/egg
- Homepage: https://github.com/eggjs/egg/tree/next/tegg/core/schedule-decorator
- Issues: https://github.com/eggjs/egg/issues
- npm.io page: https://npm.io/package/@eggjs/schedule-decorator

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 4.0.2 (latest) — 2026-10-06
- 4.0.2-rc.1 (rc) — 2026-10-06
- 4.0.2-beta.27 (beta) — 2026-09-20
- 4.0.2-rc.0 — 2026-09-23
- 4.0.2-beta.26 — 2026-08-07
- 4.0.2-beta.25 — 2026-07-13
- 4.0.2-beta.24 — 2026-07-12
- 4.0.2-beta.23 — 2026-07-11
- 4.0.2-beta.22 — 2026-07-11
- 4.0.2-beta.20 — 2026-07-09
- 4.0.2-beta.19 — 2026-06-29
- 4.0.2-beta.17 — 2026-06-28
- 4.0.2-beta.16 — 2026-06-26
- 4.0.2-beta.15 — 2026-06-26
- 4.0.2-beta.14 — 2026-06-25
- … 23 more at https://npm.io/package/@eggjs/schedule-decorator/versions

## README

# `@eggjs/schedule-decorator`

[![NPM version][npm-image]][npm-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]
[![Node.js Version](https://img.shields.io/node/v/@eggjs/schedule-decorator.svg?style=flat)](https://nodejs.org/en/download/)

[npm-image]: https://img.shields.io/npm/v/@eggjs/schedule-decorator.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@eggjs/schedule-decorator
[snyk-image]: https://snyk.io/test/npm/@eggjs/schedule-decorator/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@eggjs/schedule-decorator
[download-image]: https://img.shields.io/npm/dm/@eggjs/schedule-decorator.svg?style=flat-square
[download-url]: https://npmjs.org/package/@eggjs/schedule-decorator

## Install

```shell
npm i --save @eggjs/schedule-decorator
```

## Define schedule subscriber

```ts
import { Schedule } from '@eggjs/tegg';

// use number to define schedule interval
@Schedule<IntervalParams>({
  type: ScheduleType.WORKER,
  scheduleData: {
    // run every 100ms
    interval: 100,
  },
})
export class FooSubscriber {
  @Inject()
  private readonly logger: EggLogger;

  async subscribe() {
    this.logger.info('schedule called');
  }
}

// use cron to define schedule interval
@Schedule<CronParams>({
  type: ScheduleType.WORKER,
  scheduleData: {
    cron: '0 0 3 * * *',
  },
})
export class FooSubscriber {
  @Inject()
  private readonly logger: EggLogger;

  async subscribe() {
    this.logger.info('schedule called');
  }
}
```

---
_Source: https://npm.io/package/@eggjs/schedule-decorator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
