Skip to content

Commit

Permalink
doc: update example
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianwessel committed Jul 12, 2024
1 parent 445c042 commit 72e4a7e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions docs/example-request.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<html>
<title>@sebastianwessel/quickjs</title>
<body>Hello World</body>
</html>
10 changes: 5 additions & 5 deletions docs/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@

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

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

const body = await response.text()
console.log('Response body: ', body)
return body
}catch(err){
console.error('Failed to fetch! Check browser console!')
console.error(JSON.stringify(err,null,2))
Expand Down Expand Up @@ -130,9 +133,6 @@
error: (message)=>logMessage('error text-red-500', message),
}
})




try {
const res = await evalCode(code);
Expand Down
10 changes: 5 additions & 5 deletions example/browser/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@

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

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

const body = await response.text()
console.log('Response body: ', body)
return body
}catch(err){
console.error('Failed to fetch! Check browser console!')
console.error(JSON.stringify(err,null,2))
Expand Down Expand Up @@ -130,9 +133,6 @@
error: (message)=>logMessage('error text-red-500', message),
}
})




try {
const res = await evalCode(code);
Expand Down

0 comments on commit 72e4a7e

Please sign in to comment.