Skip to content

Commit

Permalink
add browser import examples
Browse files Browse the repository at this point in the history
  • Loading branch information
justjake committed Dec 27, 2023
1 parent 9888d9a commit 2f867f7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/esmodule.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>IIFE Global example</title>
</head>
<body>
Open your console
</body>

<!-- Import from a ES Module CDN -->
<script type="module">
import { getQuickJS } from "https://esm.run/[email protected]"
const QuickJS = await getQuickJS()
console.log(QuickJS.evalCode("1+1"))
</script>
</html>
21 changes: 21 additions & 0 deletions examples/iife-global.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>IIFE Global example</title>
</head>
<body>
Open your console
</body>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"
type="text/javascript"
></script>
<!-- Then use in a script tag -->
<script type="text/javascript">
window.getQuickJS().then((QuickJS) => {
console.log(QuickJS.evalCode("1+1"))
})
</script>
</html>

0 comments on commit 2f867f7

Please sign in to comment.