@webqit/webflo 1.0.16 → 1.0.17

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.
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "1.0.16",
15
+ "version": "1.0.17",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -78,15 +78,17 @@ export class WebfloRouter {
78
78
  thisTick.event.onRespondWith = null;
79
79
  res(response);
80
80
  };
81
- const $returnValue = handler.call(thisContext, thisTick.event, thisTick.arg, _next/*next*/, remoteFetch);
81
+ const $returnValue = Promise.resolve(handler.call(thisContext, thisTick.event, thisTick.arg, _next/*next*/, remoteFetch));
82
+ // This should listen first before waitUntil's listener
83
+ $returnValue.then(async (returnValue) => {
84
+ if (thisTick.event.onRespondWith) {
85
+ thisTick.event.onRespondWith = null;
86
+ res(returnValue);
87
+ } else if (typeof returnValue !== 'undefined') {
88
+ await thisTick.event.respondWith(returnValue);
89
+ }
90
+ });
82
91
  thisTick.event.waitUntil($returnValue);
83
- const returnValue = await $returnValue;
84
- if (thisTick.event.onRespondWith) {
85
- thisTick.event.onRespondWith = null;
86
- res(returnValue);
87
- } else if (typeof returnValue !== 'undefined') {
88
- await thisTick.event.respondWith(returnValue);
89
- }
90
92
  });
91
93
  }
92
94
  // Handler not found but exports found
@@ -397,13 +397,10 @@ export class WebfloClient extends WebfloRuntime {
397
397
  }
398
398
  }
399
399
  Promise.all([...scope.eventLifecyclePromises]).then(() => {
400
- if (scope.clientMessaging.isMessaging()) {
401
- scope.clientMessaging.on('connected', () => {
402
- setTimeout(() => {
403
- scope.clientMessaging.close();
404
- }, 100);
405
- });
406
- } else scope.clientMessaging.close();
400
+ if (!scope.clientMessaging.isMessaging()) {
401
+ // DOn't clos the below; think the below: scope.httpEvent.client.postMessage()
402
+ //scope.clientMessaging.close();
403
+ }
407
404
  });
408
405
  // ---------------
409
406
  // Decode response