# ts-schedule

> Allows task scheduling functionality in TypeScript using decorators.

Latest version **1.0.1** (published 2021-04-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install ts-schedule
pnpm add ts-schedule
yarn add ts-schedule
bun add ts-schedule
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-04-16 |
| First published | 2021-04-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kris Foster |
| Maintainers | kriscfoster |
| Keywords | typescript, schedule, decorator |

## Links

- npm: https://www.npmjs.com/package/ts-schedule
- Repository: https://github.com/kriscfoster/ts-schedule
- Issues: https://github.com/kriscfoster/ts-schedule/issues
- npm.io page: https://npm.io/package/ts-schedule

## Dependencies (1)

- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13

## 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

- 1.0.1 (latest) — 2021-04-16
- 1.0.0 — 2021-04-16

## README

# ts-schedule

| Statements                  | Branches                | Functions                 | Lines                |
| --------------------------- | ----------------------- | ------------------------- | -------------------- |
| ![Statements](https://img.shields.io/badge/Coverage-90.24%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-80%25-yellow.svg) | ![Functions](https://img.shields.io/badge/Coverage-92.86%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-89.74%25-yellow.svg)    |

Allows scheduling functionality in TypeScript using decorators.

### Prerequisites
`npm install ts-schedule`

To use decorators in TypeScript, you will need to add the following to your `tsconfig.json`:

```json
{
  "compilerOptions": {
    "experimentalDecorators": true
  }
}
```

### Usage
```ts
@enableScheduling()
class Foo {
  @scheduled(1000) // bar1 will run every 1000ms
  bar1() {
    console.log('bar1');
  }

  @scheduled(1000, 5000) // bar2 will run every 1000ms after an intial 5000ms delay
  bar2() {
    console.log('bar2');
  }
}

new Foo();
```

### Output
```text
bar1
bar1
bar1
bar1
bar2
bar1
bar2
bar1
```

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