1.0.1 • Published 1 year ago
@grandlinex/bundle-cron v1.0.1
GrandLineX Cron Bundle
Cron support for GrandLineX
Description
GrandLineX is an out-of-the-box server framework.
Status
Issues
Install
Example
class TestKernel extends CoreKernel<any> {
  constructor(appName:string, appCode:string) {
    super( { appName, appCode});
    
    // ...
      /** 
       * Add the module to the kernel
       */
      
      this.addModule(new CronModule(this));
      /**
       * Define kernel event
       */
      
      this.on("test-trigger",()=>{
          console.log("test-trigger");
      })
      
      /**
       * Add cron timer
       */
      const mod = kernel.getChildModule('cron') as CronModule;
     
      const client = mod.getClient() as CronClient;
       client.registerCron({
          trigger: 'test-trigger',
          name: 'test',
          cron: '0 * * * *',
      });
  }
}