Last active
December 8, 2017 15:23
-
-
Save earnubs/39edfedbc8148bce863829f983230ef5 to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/manazux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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