How to use the whatwg-fetch function in whatwg-fetch

To help you get started, we’ve selected a few whatwg-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github berty / berty / client / react-native / common / registerServiceWorker.js View on Github external
function checkValidServiceWorker (swUrl) {
  // Check if the service worker can be found. If it can't reload the page.
  fetch(swUrl)
    .then(response => {
      // Ensure service worker exists, and that we really are getting a JS file.
      if (
        response.status === 404 ||
        response.headers.get('content-type').indexOf('javascript') === -1
      ) {
        // No service worker found. Probably a different app. Reload the page.
        navigator.serviceWorker.ready.then(registration => {
          registration.unregister().then(() => {
            window.location.reload()
          })
        })
      } else {
        // Service worker found. Proceed as normal.
        registerValidSW(swUrl)
      }
github olymp / olymp / src2 / cms / views / media / utils / upload.js View on Github external
}).then(({ data }) => {
    cloudinary = data.cloudinaryRequest;
    const body = new FormData();
    body.append('api_key', cloudinary.apiKey);
    body.append('signature', cloudinary.signature);
    body.append('timestamp', cloudinary.timestamp);
    [].slice.call(files).forEach(file => body.attach('file', file));
    return fetch(cloudinary.url, {
      method: 'POST',
      body,
    });
  }).then(({ body }) => {
    body.id = body.public_id;
github olymp / olymp / src / _old / cms / views / media / utils / upload.js View on Github external
.then(({ data }) => {
      cloudinary = data.cloudinaryRequest;
      const body = new FormData();
      body.append('api_key', cloudinary.apiKey);
      body.append('signature', cloudinary.signature);
      body.append('timestamp', cloudinary.timestamp);
      [].slice.call(files).forEach(file => body.attach('file', file));
      return fetch(cloudinary.url, {
        method: 'POST',
        body,
      });
    })
    .then(({ body }) => {

whatwg-fetch

A window.fetch polyfill.

MIT
Latest version published 4 months ago

Package Health Score

93 / 100
Full package analysis