@travetto/schedule

1.0.0-beta.3 • Public • Published

travetto: Schedule

Install: primary

$ npm install @travetto/schedule

This module provides the ability to execute functionality at specific intervals within the application. Under the covers, the module wraps cron. The scheduling api provides high level constructs for simple intervals, and , and job termination. Also manages all outstanding jobs, and will terminate all jobs on shutdown.

Additionally, supports the full cron syntax for any specific scheduling needed.

Code: Scheduling an operation every minute

@Injectable()
class Scheduling {

  async heartbeat() {
    Scheduler.perMinute(() => {
      ... request against server ...
      if (!alive) {
        ... handle status ...
      }
    });
  }
}

Package Sidebar

Install

npm i @travetto/schedule

Homepage

travetto.io

Weekly Downloads

1

Version

1.0.0-beta.3

License

MIT

Unpacked Size

4.2 kB

Total Files

6

Last publish

Collaborators

  • arcsine