Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 2x 2x 2x | import CoreLoopService from '../classes/CoreLoopService';
import type { ICoreKernelModule } from '../lib';
/**
* A service that performs background tasks on a periodic schedule.
*
* This service extends {@link CoreLoopService} and automatically triggers its
* {@link loop} method every 120000 milliseconds (2 minutes). The {@link loop}
* implementation simply delegates to the base class's {@link CoreLoopService#next}
* routine, ensuring that any queued background work is processed.
*
* @class
* @extends CoreLoopService
*
* @param {ICoreKernelModule<any, any, any, any, any>} module
* The kernel module instance that the service will operate within.
*/
export default class BackgroundService extends CoreLoopService {
constructor(module: ICoreKernelModule<any, any, any, any, any>) {
super('background-service', 120000, module);
this.loop = this.loop.bind(this);
}
async loop() {
await this.next();
}
}
|