(context = {})
| 307 | |
| 308 | // Run all plugin shutdown handlers. Called on exit for cleanup. |
| 309 | async runShutdown(context = {}) { |
| 310 | for (const { handler, plugin } of this.shutdownHandlers) { |
| 311 | try { |
| 312 | await handler(context); |
| 313 | } catch (e) { |
| 314 | console.error(`[plugin:${plugin}] shutdown failed: ${e.message}`); |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | // Execute hooks for a given event. Returns array of results from non-void handlers. |
| 320 | async runHooks(event, data = {}) { |