polyfill: first draft to polyfill fetch api

This commit is contained in:
Pierre Tachoire
2024-11-27 16:34:40 +01:00
parent 3088c7a632
commit 4138c6fe95
7 changed files with 773 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<script>
(async function() {
const response = await fetch(new Request('https://httpbin.io/json'));
if (response.ok) {
document.firstElementChild.appendChild(document.createTextNode(response.ok+"\n"));
const body = await response.text();
document.firstElementChild.appendChild(document.createTextNode("body:"+body+"\n"));
}
}());
</script>