@artus/core
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -67,3 +67,4 @@ "use strict"; | ||
try { | ||
await this.lifecycleManager.emitHook('beforeClose'); | ||
// reverse emitHook to avoid plugin closed before app hook | ||
await this.lifecycleManager.emitHook('beforeClose', null, true); | ||
} | ||
@@ -70,0 +71,0 @@ catch (e) { |
@@ -19,3 +19,3 @@ import { Constructable } from '@artus/injection'; | ||
registerHookUnit(extClazz: Constructable<any>): void; | ||
emitHook<T = unknown>(hookName: string, payload?: T): Promise<void>; | ||
emitHook<T = unknown>(hookName: string, payload?: T, reverse?: boolean): Promise<void>; | ||
} |
@@ -55,3 +55,3 @@ "use strict"; | ||
} | ||
async emitHook(hookName, payload) { | ||
async emitHook(hookName, payload, reverse = false) { | ||
if (!this.enable) { | ||
@@ -69,2 +69,5 @@ return; | ||
this.hookFnMap.delete(hookName); | ||
if (reverse) { | ||
fnList.reverse(); | ||
} | ||
for (const hookFn of fnList) { | ||
@@ -71,0 +74,0 @@ await hookFn({ |
{ | ||
"name": "@artus/core", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Core package of Artus", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
119607
117
2890
11