occaecatidicta
Version:
27 lines (21 loc) • 725 B
text/typescript
import { ILifeCycle, Application } from 'omelox';
export default function () {
return new Lifecycle();
}
class Lifecycle implements ILifeCycle {
beforeStartup(app: Application, cb: () => void): void {
console.log(app.getServerId(), '!!!before startup');
cb();
}
afterStartup(app: Application, cb: () => void): void {
console.log(app.getServerId(), '!!afterStartup');
cb();
}
afterStartAll(app: Application): void {
console.log(app.getServerId(), '!!after start all');
}
beforeShutdown(app: Application, shutDown: () => void, cancelShutDownTimer: () => void) {
console.log(app.getServerId(), '!!beforeShutdown');
shutDown();
}
}