Skip to content

Commit 9c04ef0

Browse files
committed
optimize fetchApi selector
1 parent cd1649d commit 9c04ef0

File tree

4 files changed

+15
-19
lines changed

4 files changed

+15
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 3.0.2
2+
3+
- optimize fetchApi selector
4+
15
### 3.0.1
26

37
- try to get rid of top-level await

i18nextHttpBackend.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,11 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
216216
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
217217
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
218218
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
219-
var fetchApi;
220-
if (typeof fetch === 'function') {
221-
if (typeof global !== 'undefined' && global.fetch) {
222-
fetchApi = global.fetch;
223-
} else if (typeof window !== 'undefined' && window.fetch) {
224-
fetchApi = window.fetch;
225-
} else {
226-
fetchApi = fetch;
227-
}
219+
var fetchApi = typeof fetch === 'function' ? fetch : undefined;
220+
if (typeof global !== 'undefined' && global.fetch) {
221+
fetchApi = global.fetch;
222+
} else if (typeof window !== 'undefined' && window.fetch) {
223+
fetchApi = window.fetch;
228224
}
229225
var XmlHttpRequestApi;
230226
if ((0, _utils.hasXMLHttpRequest)()) {

0 commit comments

Comments
 (0)