@prismicio/client
Advanced tools
Comparing version 6.0.0-alpha.3 to 6.0.0-alpha.4
@@ -253,6 +253,9 @@ const getEndpoint = (repositoryName) => `https://${repositoryName}.cdn.prismic.io/api/v2`; | ||
} else if (typeof globalThis.fetch === "function") { | ||
this.fetchFn = globalThis.fetch.bind(globalThis); | ||
this.fetchFn = globalThis.fetch; | ||
} else { | ||
throw new Error("A valid fetch implementation was not provided. In environments where fetch is not available (including Node.js), a fetch implementation must be provided via a polyfill or the `fetch` option."); | ||
} | ||
if (this.fetchFn === globalThis.fetch) { | ||
this.fetchFn = this.fetchFn.bind(globalThis); | ||
} | ||
} | ||
@@ -259,0 +262,0 @@ enableAutoPreviews() { |
{ | ||
"name": "@prismicio/client", | ||
"version": "6.0.0-alpha.3", | ||
"version": "6.0.0-alpha.4", | ||
"description": "The official JavaScript + TypeScript client library for Prismic", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -323,3 +323,3 @@ import * as prismicT from "@prismicio/types"; | ||
} else if (typeof globalThis.fetch === "function") { | ||
this.fetchFn = globalThis.fetch.bind(globalThis); | ||
this.fetchFn = globalThis.fetch; | ||
} else { | ||
@@ -330,2 +330,7 @@ throw new Error( | ||
} | ||
// If the global fetch function is used, we must bind it to the global scope. | ||
if (this.fetchFn === globalThis.fetch) { | ||
this.fetchFn = this.fetchFn.bind(globalThis); | ||
} | ||
} | ||
@@ -332,0 +337,0 @@ |
Sorry, the diff of this file is not supported yet
165886
4067