@@ -17,7 +17,6 @@ export function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydr
17
17
var close = () => {};
18
18
var confirm = $stencilWindow.confirm.bind($stencilWindow);
19
19
var dispatchEvent = $stencilWindow.dispatchEvent.bind($stencilWindow);
20
- var fetch = $stencilWindow.fetch.bind($stencilWindow);
21
20
var focus = $stencilWindow.focus.bind($stencilWindow);
22
21
var getComputedStyle = $stencilWindow.getComputedStyle.bind($stencilWindow);
23
22
var matchMedia = $stencilWindow.matchMedia.bind($stencilWindow);
@@ -38,8 +37,6 @@ export function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydr
38
37
var DOMTokenList = $stencilWindow.DOMTokenList;
39
38
var Element = $stencilWindow.Element;
40
39
var Event = $stencilWindow.Event;
41
- var FetchError = $stencilWindow.FetchError;
42
- var Headers = $stencilWindow.Headers;
43
40
var HTMLAnchorElement = $stencilWindow.HTMLAnchorElement;
44
41
var HTMLBaseElement = $stencilWindow.HTMLBaseElement;
45
42
var HTMLButtonElement = $stencilWindow.HTMLButtonElement;
@@ -59,8 +56,6 @@ export function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydr
59
56
var MouseEvent = $stencilWindow.MouseEvent;
60
57
var Node = $stencilWindow.Node;
61
58
var NodeList = $stencilWindow.NodeList;
62
- var Request = $stencilWindow.Request;
63
- var Response = $stencilWindow.Response;
64
59
var URL = $stencilWindow.URL;
65
60
66
61
var console = $stencilWindow.console;
@@ -87,6 +82,38 @@ export function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydr
87
82
var scrollY = $stencilWindow.scrollY;
88
83
var exports = {};
89
84
85
+ var fetch, FetchError, Headers, Request, Response;
86
+
87
+ if (typeof $stencilWindow.fetch === 'function') {
88
+ fetch = $stencilWindow.fetch;
89
+ } else {
90
+ fetch = $stencilWindow.fetch = function() { throw new Error('fetch() is not implemented'); };
91
+ }
92
+
93
+ if (typeof $stencilWindow.FetchError === 'function') {
94
+ FetchError = $stencilWindow.FetchError;
95
+ } else {
96
+ FetchError = $stencilWindow.FetchError = class FetchError { constructor() { throw new Error('FetchError is not implemented'); } };
97
+ }
98
+
99
+ if (typeof $stencilWindow.Headers === 'function') {
100
+ Headers = $stencilWindow.Headers;
101
+ } else {
102
+ Headers = $stencilWindow.Headers = class Headers { constructor() { throw new Error('Headers is not implemented'); } };
103
+ }
104
+
105
+ if (typeof $stencilWindow.Request === 'function') {
106
+ Request = $stencilWindow.Request;
107
+ } else {
108
+ Request = $stencilWindow.Request = class Request { constructor() { throw new Error('Request is not implemented'); } };
109
+ }
110
+
111
+ if (typeof $stencilWindow.Response === 'function') {
112
+ Response = $stencilWindow.Response;
113
+ } else {
114
+ Response = $stencilWindow.Response = class Response { constructor() { throw new Error('Response is not implemented'); } };
115
+ }
116
+
90
117
function hydrateAppClosure($stencilWindow) {
91
118
const window = $stencilWindow;
92
119
const document = $stencilWindow.document;
0 commit comments