mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
polyfill: first draft to polyfill fetch api
This commit is contained in:
10
tests/html/await-fetch.html
Normal file
10
tests/html/await-fetch.html
Normal 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>
|
||||
Reference in New Issue
Block a user