Skip to content

Commit

Permalink
doc: fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianwessel committed Jul 12, 2024
1 parent 008c91b commit 8bf7510
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
9 changes: 1 addition & 8 deletions docs/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,14 @@
console.warn('Might be cool!')

const getExample = async ()=> {
try {
const response = await fetch('https://sebastianwessel.github.io/quickjs/example-request.html')

if(!response.ok) {
console.error('Request failed: ' + response.status + ' ' + response.statusText)
return
}

const body = await response.text()
console.log('Response body: ', body)
console.log('Response body: '+ body)
return body
}catch(err){
console.error('Failed to fetch! Check browser console!')
console.error(JSON.stringify(err,null,2))
}
}

await getExample()
Expand Down
9 changes: 1 addition & 8 deletions example/browser/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,14 @@
console.warn('Might be cool!')

const getExample = async ()=> {
try {
const response = await fetch('https://sebastianwessel.github.io/quickjs/example-request.html')

if(!response.ok) {
console.error('Request failed: ' + response.status + ' ' + response.statusText)
return
}

const body = await response.text()
console.log('Response body: ', body)
console.log('Response body: '+ body)
return body
}catch(err){
console.error('Failed to fetch! Check browser console!')
console.error(JSON.stringify(err,null,2))
}
}

await getExample()
Expand Down

0 comments on commit 8bf7510

Please sign in to comment.