Cron support for GrandLineX
GrandLineX is an out-of-the-box server framework.
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 * * * *',
});
}
}