@webqit/webflo 0.11.54 → 0.11.55-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.
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.11.54",
15
+ "version": "0.11.55-0",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -86,18 +86,19 @@ export default class Runtime extends _Runtime {
86
86
  self.addEventListener('fetch', event => {
87
87
  // URL schemes that might arrive here but not supported; e.g.: chrome-extension://
88
88
  if (!event.request.url.startsWith('http')) return;
89
- event.respondWith((async (req, evt) => {
90
- let requestingClient = await self.clients.get(event.clientId);
89
+ event.respondWith((async evt => {
90
+ let requestingClient = await self.clients.get(evt.clientId);
91
91
  this.workport.setCurrentClient(requestingClient);
92
92
  // Now, the following is key:
93
93
  // The browser likes to use "force-cache" for "navigate" requests, when, e.g: re-entering your site with the back button
94
94
  // Problem here, force-cache forces out JSON not HTML as per webflo's design.
95
95
  // So, we detect this scenerio and avoid it.
96
- if (req.cache === 'force-cache'/* && req.mode === 'navigate' - even webflo client init call also comes with that... needs investigation */) {
97
- req = new Request(req, {cache: 'default'});
96
+ if (evt.request.cache === 'force-cache'/* && evt.request.mode === 'navigate' - even webflo client init call also comes with that... needs investigation */) {
97
+ const req = new Request(evt.request, { cache: 'default' });
98
+ Object.defineProperty(evt, 'request', { value: req });
98
99
  }
99
- return this.go(req.url, req, { event: evt });
100
- })(event.request, event));
100
+ return this.go(evt.request.url, evt.request, { event: evt });
101
+ })(event));
101
102
  });
102
103
 
103
104
  // -------------
@@ -134,9 +135,6 @@ export default class Runtime extends _Runtime {
134
135
  // ------------
135
136
  // The request object
136
137
  const request = this.generateRequest(url.href, init);
137
- if (detail.event) {
138
- Object.defineProperty(detail.event, 'request', { value: request });
139
- }
140
138
  // The navigation event
141
139
  const httpEvent = new HttpEvent(request, detail, (id = null, persistent = false) => this.getSession(httpEvent, id, persistent));
142
140
  httpEvent.port.listen(message => {