JSPM

  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q32574F
  • License MIT

Managed registry for scheduling jobs using cron expressions.

Package Exports

  • @travetto/schedule

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@travetto/schedule) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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 ...
      }
    });
  }
}