configurapi 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/service.js +12 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configurapi",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "A configurable API framework",
5
5
  "main": "src/configurapi.js",
6
6
  "types": "src/configurapi.d.ts",
package/src/service.js CHANGED
@@ -82,17 +82,27 @@ module.exports = class Service extends events.EventEmitter
82
82
 
83
83
  this.emit(LogLevel.Trace, `configurapi - - Registerd ${route.name} route.`);
84
84
  });
85
+ }
85
86
 
86
- this.onStartPromise = this._handleEvent('on_start');
87
+ initDone;
88
+ async init()
89
+ {
90
+ this.onStartPromise ??= this._handleEvent('on_start');
91
+ await this.onStartPromise;
92
+ this.initDone = true;
87
93
  }
88
94
 
89
95
  async process(event)
90
96
  {
97
+ if (!this.initDone)
98
+ {
99
+ await this.init();
100
+ }
101
+
91
102
  if (!this.isReady)
92
103
  {
93
104
  try
94
105
  {
95
- await this.onStartPromise
96
106
  await this._handleEvent('on_first_request', event);
97
107
  }
98
108
  catch(error)