Skip to content

Instantly share code, notes, and snippets.

@earnubs
Last active December 8, 2017 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save earnubs/39edfedbc8148bce863829f983230ef5 to your computer and use it in GitHub Desktop.
Save earnubs/39edfedbc8148bce863829f983230ef5 to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/manazux
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script>delete window.fetch;</script>
<script src="https://cdn.rawgit.com/zloirock/core-js/master/client/shim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/whatwg-fetch@2.0.3/fetch.min.js"></script>
<script id="jsbin-javascript">
'use strict';
window.onunhandledrejection = function () {
console.log('Success, got an unhandledrejection!');
};
if (window.fetch.polyfill) {
console.log('You are using the whatwg-fetch polyfill, try commenting out the first script block in the HTML tab to use the native fetch implementation.');
} else {
console.log('Not using whatwg-fetch polyfill');
}
// will cause a network failure and reject becuase it's http not https
window.fetch('http://www.mocky.io/v2/5a2a70652d0000ff1391b0fb');
</script>
</body>
</html>
'use strict';
window.onunhandledrejection = function () {
console.log('Success, got an unhandledrejection!');
};
if (window.fetch.polyfill) {
console.log('You are using the whatwg-fetch polyfill, try commenting out the first script block in the HTML tab to use the native fetch implementation.');
} else {
console.log('Not using whatwg-fetch polyfill');
}
// will cause a network failure and reject becuase it's http not https
window.fetch('http://www.mocky.io/v2/5a2a70652d0000ff1391b0fb');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment