0.2.1 • Published 4 years ago

nest-task-module v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Description

Task Module for NestJS using Cron

Installation

$ npm install nest-task-module

Import task module to AppModule

import { Module } from '@nestjs/common';
import { TaskModule } from 'nest-task-module';
import { TaskName } from './tasks';

@Module({
  imports: [
    TaskModule.register({
      controller: true,
      tasks: [ TaskName ],
    }),
  ],
})
export class AppModule {}

API

TaskModule

  • register
    • controller - enable controller
    • tasks - REQUIRED array of tasks implementing CronJobParameter
    • instanceble - provider to determine the master instance
  • registerAsync
    • controller - enable controller
    • tasks - REQUIRED array of tasks implementing CronJobParameter
    • instanceble - PROMISE provider to determine the master instance

CronJobParameter

import { CronJobParameters } from 'cron';

interface CronJobParameter extends CronJobParameters {
  name: string;
}

Task

class Task extends CronJob {
  public name: string;

  get isRunning(): boolean;
  get cronSourceTime(): string;
  get cronTimeZone(): string;
  get nextRunDate(): Date;
  get lastRunDate(): Date;

  constructor(task: CronJobParameter);
}
0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago