fetchival icon indicating copy to clipboard operation
fetchival copied to clipboard

Fetchival not working with Safari

Open adadgio opened this issue 9 years ago • 3 comments

I suspect something inside a Promise is not working inside fetchival. Its is not working with Version 9.1.3, and no error messages are shown. The promise never gest fulfilled.

Code example bellow (work on Chrome and Firefox).

console.log('Console log works here');

fetchival(module.settings.endpoint(['user', apiKey])).get().then(function(response) {
    console.log("Iam here, but never works on safari");
    console.log(response);

});

adadgio avatar Sep 19 '16 13:09 adadgio

Just to confirm what I'v said, i have replaced the fetchival Ajax code by a random library (https://github.com/yanatan16/nanoajax), and it works in Safari.

adadgio avatar Sep 19 '16 13:09 adadgio

fetchival is base on window.fetch

// Expose fetch so that other polyfills can be used
  // Bind fetch to window to avoid TypeError: Illegal invocation
  fetchival.fetch = typeof fetch !== 'undefined' ? fetch.bind(window) : null

Safari is not support fetch

xiaokaike avatar Oct 24 '16 09:10 xiaokaike

Hi @adadgio,

fetchival doesn't come with fetch polyfill, but you can use the following command and you should have everything you need ;)

npm install es6-promise whatwg-fetch --save # polyfills
npm install fetchival --save

typicode avatar Oct 25 '16 21:10 typicode