Skip to content

Commit e30c433

Browse files
committed
README updates
1 parent 1f03c98 commit e30c433

File tree

7 files changed

+130
-34
lines changed

7 files changed

+130
-34
lines changed

CHANGELOG.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
You can also use quickjs-emscripten directly from an HTML file in two ways:
2222

2323
```html
24+
<!doctype html>
2425
<!-- Import from a ES Module CDN -->
2526
<script type="module">
2627
import { getQuickJS } from "https://esm.run/[email protected]"
@@ -29,15 +30,16 @@ You can also use quickjs-emscripten directly from an HTML file in two ways:
2930
</script>
3031
```
3132

32-
Or in older browsers, you can reference the IIFE build:
33+
In edge cases, you might want to use the IIFE build which provides QuickJS as the global `QJS`.
3334

3435
```html
35-
<!-- Add a script tag to load the library globally -->
36+
<!doctype html>
37+
<!-- Add a script tag to load the library as the QJS global -->
3638
<script
37-
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"
39+
src="https://cdn.jsdelivr.net/npm/[email protected]-rc.11/dist/index.global.js"
3840
type="text/javascript"
3941
></script>
40-
<!-- Then use in a script tag -->
42+
<!-- Then use the QJS global in a script tag -->
4143
<script type="text/javascript">
4244
QJS.getQuickJS().then((QuickJS) => {
4345
console.log(QuickJS.evalCode("1+1"))

README.md

+35-4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ main()
5858
- [Async module loader](#async-module-loader)
5959
- [Async on host, sync in QuickJS](#async-on-host-sync-in-quickjs)
6060
- [Testing your code](#testing-your-code)
61+
- [Using in the browser without a build step](#using-in-the-browser-without-a-build-step)
6162
- [quickjs-emscripten-core, variants, and advanced packaging](#quickjs-emscripten-core-variants-and-advanced-packaging)
6263
- [Debugging](#debugging)
6364
- [More Documentation](#more-documentation)
@@ -514,6 +515,39 @@ For more testing examples, please explore the typescript source of [quickjs-emsc
514515
[debug_sync]: https://github.com/justjake/quickjs-emscripten/blob/main/doc/quickjs-emscripten/exports.md#debug_sync
515516
[testquickjswasmmodule]: https://github.com/justjake/quickjs-emscripten/blob/main/doc/quickjs-emscripten/classes/TestQuickJSWASMModule.md
516517

518+
### Using in the browser without a build step
519+
520+
You can use quickjs-emscripten directly from an HTML file in two ways:
521+
522+
1. Import it in an ES Module script tag
523+
524+
```html
525+
<!doctype html>
526+
<!-- Import from a ES Module CDN -->
527+
<script type="module">
528+
import { getQuickJS } from "https://esm.sh/[email protected]"
529+
const QuickJS = await getQuickJS()
530+
console.log(QuickJS.evalCode("1+1"))
531+
</script>
532+
```
533+
534+
1. In edge cases, you might want to use the IIFE build which provides QuickJS as the global `QJS`. You should probably use the ES module though, any recent browser supports it.
535+
536+
```html
537+
<!doctype html>
538+
<!-- Add a script tag to load the library as the QJS global -->
539+
<script
540+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"
541+
type="text/javascript"
542+
></script>
543+
<!-- Then use the QJS global in a script tag -->
544+
<script type="text/javascript">
545+
QJS.getQuickJS().then((QuickJS) => {
546+
console.log(QuickJS.evalCode("1+1"))
547+
})
548+
</script>
549+
```
550+
517551
### quickjs-emscripten-core, variants, and advanced packaging
518552

519553
Them main `quickjs-emscripten` package includes several build variants of the WebAssembly module.
@@ -605,10 +639,7 @@ thinking comes next. Last updated 2022-03-18.
605639
for automatic translation.
606640
- Consider class-based or interface-type-based marshalling.
607641

608-
4. EcmaScript Modules / WebAssembly files / Deno support. This requires me to
609-
learn a lot of new things, but should be interesting for modern browser usage.
610-
611-
5. SQLite integration.
642+
4. SQLite integration.
612643

613644
## Related
614645

doc/README.md

+35-4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ main()
6262
- [Async module loader](#async-module-loader)
6363
- [Async on host, sync in QuickJS](#async-on-host-sync-in-quickjs)
6464
- [Testing your code](#testing-your-code)
65+
- [Using in the browser without a build step](#using-in-the-browser-without-a-build-step)
6566
- [quickjs-emscripten-core, variants, and advanced packaging](#quickjs-emscripten-core-variants-and-advanced-packaging)
6667
- [Debugging](#debugging)
6768
- [More Documentation](#more-documentation)
@@ -518,6 +519,39 @@ For more testing examples, please explore the typescript source of [quickjs-emsc
518519
[debug_sync]: https://github.com/justjake/quickjs-emscripten/blob/main/doc/quickjs-emscripten/exports.md#debug_sync
519520
[testquickjswasmmodule]: https://github.com/justjake/quickjs-emscripten/blob/main/doc/quickjs-emscripten/classes/TestQuickJSWASMModule.md
520521

522+
### Using in the browser without a build step
523+
524+
You can use quickjs-emscripten directly from an HTML file in two ways:
525+
526+
1. Import it in an ES Module script tag
527+
528+
```html
529+
<!doctype html>
530+
<!-- Import from a ES Module CDN -->
531+
<script type="module">
532+
import { getQuickJS } from "https://esm.sh/[email protected]"
533+
const QuickJS = await getQuickJS()
534+
console.log(QuickJS.evalCode("1+1"))
535+
</script>
536+
```
537+
538+
1. In edge cases, you might want to use the IIFE build which provides QuickJS as the global `QJS`. You should probably use the ES module though, any recent browser supports it.
539+
540+
```html
541+
<!doctype html>
542+
<!-- Add a script tag to load the library as the QJS global -->
543+
<script
544+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"
545+
type="text/javascript"
546+
></script>
547+
<!-- Then use the QJS global in a script tag -->
548+
<script type="text/javascript">
549+
QJS.getQuickJS().then((QuickJS) => {
550+
console.log(QuickJS.evalCode("1+1"))
551+
})
552+
</script>
553+
```
554+
521555
### quickjs-emscripten-core, variants, and advanced packaging
522556

523557
Them main `quickjs-emscripten` package includes several build variants of the WebAssembly module.
@@ -609,10 +643,7 @@ thinking comes next. Last updated 2022-03-18.
609643
for automatic translation.
610644
- Consider class-based or interface-type-based marshalling.
611645

612-
4. EcmaScript Modules / WebAssembly files / Deno support. This requires me to
613-
learn a lot of new things, but should be interesting for modern browser usage.
614-
615-
5. SQLite integration.
646+
4. SQLite integration.
616647

617648
## Related
618649

doc/quickjs-emscripten/README.md

+36-4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ main()
6262
- [Async module loader](#async-module-loader)
6363
- [Async on host, sync in QuickJS](#async-on-host-sync-in-quickjs)
6464
- [Testing your code](#testing-your-code)
65+
- [Using in the browser without a build step](#using-in-the-browser-without-a-build-step)
6566
- [quickjs-emscripten-core, variants, and advanced packaging](#quickjs-emscripten-core-variants-and-advanced-packaging)
6667
- [Debugging](#debugging)
6768
- [More Documentation](#more-documentation)
@@ -82,6 +83,7 @@ main()
8283
- [Memory Management](README.md#memory-management)
8384
- [Exposing APIs](README.md#exposing-apis)
8485
- [Testing your code](README.md#testing-your-code)
86+
- [Using in the browser without a build step](README.md#using-in-the-browser-without-a-build-step)
8587
- [quickjs-emscripten-core, variants, and advanced packaging](README.md#quickjs-emscripten-core-variants-and-advanced-packaging)
8688
- [Debugging](README.md#debugging)
8789
- [More Documentation](README.md#more-documentation)
@@ -538,6 +540,39 @@ For more testing examples, please explore the typescript source of [quickjs-emsc
538540
[debug_sync]: https://github.com/justjake/quickjs-emscripten/blob/main/doc/quickjs-emscripten/exports.md#debug_sync
539541
[testquickjswasmmodule]: https://github.com/justjake/quickjs-emscripten/blob/main/doc/quickjs-emscripten/classes/TestQuickJSWASMModule.md
540542

543+
### Using in the browser without a build step
544+
545+
You can use quickjs-emscripten directly from an HTML file in two ways:
546+
547+
1. Import it in an ES Module script tag
548+
549+
```html
550+
<!doctype html>
551+
<!-- Import from a ES Module CDN -->
552+
<script type="module">
553+
import { getQuickJS } from "https://esm.sh/[email protected]"
554+
const QuickJS = await getQuickJS()
555+
console.log(QuickJS.evalCode("1+1"))
556+
</script>
557+
```
558+
559+
1. In edge cases, you might want to use the IIFE build which provides QuickJS as the global `QJS`. You should probably use the ES module though, any recent browser supports it.
560+
561+
```html
562+
<!doctype html>
563+
<!-- Add a script tag to load the library as the QJS global -->
564+
<script
565+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"
566+
type="text/javascript"
567+
></script>
568+
<!-- Then use the QJS global in a script tag -->
569+
<script type="text/javascript">
570+
QJS.getQuickJS().then((QuickJS) => {
571+
console.log(QuickJS.evalCode("1+1"))
572+
})
573+
</script>
574+
```
575+
541576
### quickjs-emscripten-core, variants, and advanced packaging
542577

543578
Them main `quickjs-emscripten` package includes several build variants of the WebAssembly module.
@@ -629,10 +664,7 @@ thinking comes next. Last updated 2022-03-18.
629664
for automatic translation.
630665
- Consider class-based or interface-type-based marshalling.
631666

632-
4. EcmaScript Modules / WebAssembly files / Deno support. This requires me to
633-
learn a lot of new things, but should be interesting for modern browser usage.
634-
635-
5. SQLite integration.
667+
4. SQLite integration.
636668

637669
## Related
638670

examples/esmodule.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<!-- Import from a ES Module CDN -->
1313
<script type="module">
14-
import { getQuickJS } from "https://esm.sh/[email protected]-rc.11"
14+
import { getQuickJS } from "https://esm.sh/[email protected]"
1515
const QuickJS = await getQuickJS()
1616
console.log(QuickJS.evalCode("1+1"))
1717
</script>

examples/iife-global.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</body>
1111
<!-- Add a script tag to load the library as the QJS global -->
1212
<script
13-
src="https://cdn.jsdelivr.net/npm/[email protected]-rc.11/dist/index.global.js"
13+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"
1414
type="text/javascript"
1515
></script>
1616
<!-- Then use the QJS global in a script tag -->

variants.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"dir": "packages/variant-quickjs-wasmfile-debug-sync",
66
"packageJson": {
77
"name": "@jitl/quickjs-wasmfile-debug-sync",
8-
"version": "0.25.0-rc.11",
8+
"version": "0.25.0-rc.12",
99
"description": "Variant of quickjs library: Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.",
1010
"sideEffects": false,
1111
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -69,7 +69,7 @@
6969
"dir": "packages/variant-quickjs-wasmfile-debug-asyncify",
7070
"packageJson": {
7171
"name": "@jitl/quickjs-wasmfile-debug-asyncify",
72-
"version": "0.25.0-rc.11",
72+
"version": "0.25.0-rc.12",
7373
"description": "Variant of quickjs library: Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.",
7474
"sideEffects": false,
7575
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -133,7 +133,7 @@
133133
"dir": "packages/variant-quickjs-wasmfile-release-sync",
134134
"packageJson": {
135135
"name": "@jitl/quickjs-wasmfile-release-sync",
136-
"version": "0.25.0-rc.11",
136+
"version": "0.25.0-rc.12",
137137
"description": "Variant of quickjs library: Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.",
138138
"sideEffects": false,
139139
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -197,7 +197,7 @@
197197
"dir": "packages/variant-quickjs-wasmfile-release-asyncify",
198198
"packageJson": {
199199
"name": "@jitl/quickjs-wasmfile-release-asyncify",
200-
"version": "0.25.0-rc.11",
200+
"version": "0.25.0-rc.12",
201201
"description": "Variant of quickjs library: Variant with separate .WASM file. Supports browser ESM, NodeJS ESM, and NodeJS CommonJS.",
202202
"sideEffects": false,
203203
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -261,7 +261,7 @@
261261
"dir": "packages/variant-quickjs-singlefile-cjs-debug-sync",
262262
"packageJson": {
263263
"name": "@jitl/quickjs-singlefile-cjs-debug-sync",
264-
"version": "0.25.0-rc.11",
264+
"version": "0.25.0-rc.12",
265265
"description": "Variant of quickjs library: Variant with the WASM data embedded into a universal (Node and Browser compatible) CommonJS module.",
266266
"sideEffects": false,
267267
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -317,7 +317,7 @@
317317
"dir": "packages/variant-quickjs-singlefile-cjs-debug-asyncify",
318318
"packageJson": {
319319
"name": "@jitl/quickjs-singlefile-cjs-debug-asyncify",
320-
"version": "0.25.0-rc.11",
320+
"version": "0.25.0-rc.12",
321321
"description": "Variant of quickjs library: Variant with the WASM data embedded into a universal (Node and Browser compatible) CommonJS module.",
322322
"sideEffects": false,
323323
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -373,7 +373,7 @@
373373
"dir": "packages/variant-quickjs-singlefile-cjs-release-sync",
374374
"packageJson": {
375375
"name": "@jitl/quickjs-singlefile-cjs-release-sync",
376-
"version": "0.25.0-rc.11",
376+
"version": "0.25.0-rc.12",
377377
"description": "Variant of quickjs library: Variant with the WASM data embedded into a universal (Node and Browser compatible) CommonJS module.",
378378
"sideEffects": false,
379379
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -429,7 +429,7 @@
429429
"dir": "packages/variant-quickjs-singlefile-cjs-release-asyncify",
430430
"packageJson": {
431431
"name": "@jitl/quickjs-singlefile-cjs-release-asyncify",
432-
"version": "0.25.0-rc.11",
432+
"version": "0.25.0-rc.12",
433433
"description": "Variant of quickjs library: Variant with the WASM data embedded into a universal (Node and Browser compatible) CommonJS module.",
434434
"sideEffects": false,
435435
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -485,7 +485,7 @@
485485
"dir": "packages/variant-quickjs-singlefile-mjs-debug-sync",
486486
"packageJson": {
487487
"name": "@jitl/quickjs-singlefile-mjs-debug-sync",
488-
"version": "0.25.0-rc.11",
488+
"version": "0.25.0-rc.12",
489489
"description": "Variant of quickjs library: Variant with the WASM data embedded into a NodeJS ESModule.",
490490
"sideEffects": false,
491491
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -537,7 +537,7 @@
537537
"dir": "packages/variant-quickjs-singlefile-mjs-debug-asyncify",
538538
"packageJson": {
539539
"name": "@jitl/quickjs-singlefile-mjs-debug-asyncify",
540-
"version": "0.25.0-rc.11",
540+
"version": "0.25.0-rc.12",
541541
"description": "Variant of quickjs library: Variant with the WASM data embedded into a NodeJS ESModule.",
542542
"sideEffects": false,
543543
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -589,7 +589,7 @@
589589
"dir": "packages/variant-quickjs-singlefile-mjs-release-sync",
590590
"packageJson": {
591591
"name": "@jitl/quickjs-singlefile-mjs-release-sync",
592-
"version": "0.25.0-rc.11",
592+
"version": "0.25.0-rc.12",
593593
"description": "Variant of quickjs library: Variant with the WASM data embedded into a NodeJS ESModule.",
594594
"sideEffects": false,
595595
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -641,7 +641,7 @@
641641
"dir": "packages/variant-quickjs-singlefile-mjs-release-asyncify",
642642
"packageJson": {
643643
"name": "@jitl/quickjs-singlefile-mjs-release-asyncify",
644-
"version": "0.25.0-rc.11",
644+
"version": "0.25.0-rc.12",
645645
"description": "Variant of quickjs library: Variant with the WASM data embedded into a NodeJS ESModule.",
646646
"sideEffects": false,
647647
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -693,7 +693,7 @@
693693
"dir": "packages/variant-quickjs-singlefile-browser-debug-sync",
694694
"packageJson": {
695695
"name": "@jitl/quickjs-singlefile-browser-debug-sync",
696-
"version": "0.25.0-rc.11",
696+
"version": "0.25.0-rc.12",
697697
"description": "Variant of quickjs library: Variant with the WASM data embedded into a browser ESModule.",
698698
"sideEffects": false,
699699
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -747,7 +747,7 @@
747747
"dir": "packages/variant-quickjs-singlefile-browser-debug-asyncify",
748748
"packageJson": {
749749
"name": "@jitl/quickjs-singlefile-browser-debug-asyncify",
750-
"version": "0.25.0-rc.11",
750+
"version": "0.25.0-rc.12",
751751
"description": "Variant of quickjs library: Variant with the WASM data embedded into a browser ESModule.",
752752
"sideEffects": false,
753753
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -801,7 +801,7 @@
801801
"dir": "packages/variant-quickjs-singlefile-browser-release-sync",
802802
"packageJson": {
803803
"name": "@jitl/quickjs-singlefile-browser-release-sync",
804-
"version": "0.25.0-rc.11",
804+
"version": "0.25.0-rc.12",
805805
"description": "Variant of quickjs library: Variant with the WASM data embedded into a browser ESModule.",
806806
"sideEffects": false,
807807
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },
@@ -855,7 +855,7 @@
855855
"dir": "packages/variant-quickjs-singlefile-browser-release-asyncify",
856856
"packageJson": {
857857
"name": "@jitl/quickjs-singlefile-browser-release-asyncify",
858-
"version": "0.25.0-rc.11",
858+
"version": "0.25.0-rc.12",
859859
"description": "Variant of quickjs library: Variant with the WASM data embedded into a browser ESModule.",
860860
"sideEffects": false,
861861
"repository": { "type": "git", "url": "https://github.com/justjake/quickjs-emscripten" },

0 commit comments

Comments
 (0)