chore: application options (#375)
This commit is contained in:
parent
0467093dfd
commit
2d38399766
@ -178,7 +178,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
return this.cli.parseAsync(argv);
|
return this.cli.parseAsync(argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
async start(options?: StartOptions) {
|
async start(options: StartOptions = {}) {
|
||||||
// reconnect database
|
// reconnect database
|
||||||
if (this.db.closed()) {
|
if (this.db.closed()) {
|
||||||
await this.db.reconnect();
|
await this.db.reconnect();
|
||||||
@ -205,7 +205,7 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
return this.appManager.listen(...args);
|
return this.appManager.listen(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
async stop(options?: any) {
|
async stop(options: any = {}) {
|
||||||
await this.emitAsync('beforeStop', this, options);
|
await this.emitAsync('beforeStop', this, options);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -235,13 +235,13 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
|
|||||||
await this.emitAsync('afterStop', this, options);
|
await this.emitAsync('afterStop', this, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async destroy(options?: any) {
|
async destroy(options: any = {}) {
|
||||||
await this.emitAsync('beforeDestroy', this, options);
|
await this.emitAsync('beforeDestroy', this, options);
|
||||||
await this.stop(options);
|
await this.stop(options);
|
||||||
await this.emitAsync('afterDestroy', this, options);
|
await this.emitAsync('afterDestroy', this, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async install(options?: InstallOptions) {
|
async install(options: InstallOptions = {}) {
|
||||||
await this.emitAsync('beforeInstall', this, options);
|
await this.emitAsync('beforeInstall', this, options);
|
||||||
|
|
||||||
if (options?.clean) {
|
if (options?.clean) {
|
||||||
|
@ -58,7 +58,7 @@ export class PluginManager {
|
|||||||
await this.app.emitAsync('afterLoadAll');
|
await this.app.emitAsync('afterLoadAll');
|
||||||
}
|
}
|
||||||
|
|
||||||
async install(options?: InstallOptions) {
|
async install(options: InstallOptions = {}) {
|
||||||
for (const [name, plugin] of this.plugins) {
|
for (const [name, plugin] of this.plugins) {
|
||||||
await this.app.emitAsync('beforeInstallPlugin', plugin, options);
|
await this.app.emitAsync('beforeInstallPlugin', plugin, options);
|
||||||
await plugin.install(options);
|
await plugin.install(options);
|
||||||
|
Loading…
Reference in New Issue
Block a user