1.0.3 • Published 5 years ago

@trapts/schedule v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

schedule

Trap schedule loader.

install

npm install @trapts/schedule --save

example

  • app.ts
import { schedule } from '@trapts/schedule'
import { resolve } from 'path'

schedule(resolve(__dirname, 'demo'))
  • demo/test.ts
import { Subcription, Schedule } from '@trapts/schedule'

export class TestSchedule implements Subcription {
  public static schedule(): Schedule {
    return {
      disable: false,
      cron: '1 * * * * *',
      env: 'development',
      timeZone: 'Asia/Shanghai'
    }
  }
  async subscribe(): Promise<void> {
    console.log('Hello World')
  }
}