typicode / fetchival

Easy window.fetch requests
MIT License
521 stars 33 forks source link

Fetchival not working with Safari #15

Open adadgio opened 8 years ago

adadgio commented 8 years ago

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 commented 8 years ago

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.

xiaokaike commented 7 years ago

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

typicode commented 7 years ago

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