From 2d383997661f229a36201ab203a271edb1324beb Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Fri, 13 May 2022 11:18:36 +0800 Subject: [PATCH] chore: application options (#375) --- packages/core/server/src/application.ts | 8 ++++---- packages/core/server/src/plugin-manager.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/server/src/application.ts b/packages/core/server/src/application.ts index 2bd7c4536..de37b866c 100644 --- a/packages/core/server/src/application.ts +++ b/packages/core/server/src/application.ts @@ -178,7 +178,7 @@ export class Application exten return this.cli.parseAsync(argv); } - async start(options?: StartOptions) { + async start(options: StartOptions = {}) { // reconnect database if (this.db.closed()) { await this.db.reconnect(); @@ -205,7 +205,7 @@ export class Application exten return this.appManager.listen(...args); } - async stop(options?: any) { + async stop(options: any = {}) { await this.emitAsync('beforeStop', this, options); try { @@ -235,13 +235,13 @@ export class Application exten await this.emitAsync('afterStop', this, options); } - async destroy(options?: any) { + async destroy(options: any = {}) { await this.emitAsync('beforeDestroy', this, options); await this.stop(options); await this.emitAsync('afterDestroy', this, options); } - async install(options?: InstallOptions) { + async install(options: InstallOptions = {}) { await this.emitAsync('beforeInstall', this, options); if (options?.clean) { diff --git a/packages/core/server/src/plugin-manager.ts b/packages/core/server/src/plugin-manager.ts index 6d0e1721c..2fb52e7a0 100644 --- a/packages/core/server/src/plugin-manager.ts +++ b/packages/core/server/src/plugin-manager.ts @@ -58,7 +58,7 @@ export class PluginManager { await this.app.emitAsync('afterLoadAll'); } - async install(options?: InstallOptions) { + async install(options: InstallOptions = {}) { for (const [name, plugin] of this.plugins) { await this.app.emitAsync('beforeInstallPlugin', plugin, options); await plugin.install(options);