Skip to content

Commit c2a6ab4

Browse files
Merge pull request #76 from sebastianwessel/codex/review-and-update-documentation
Update docs for accuracy
2 parents f9db09a + fb309db commit c2a6ab4

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

website/docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ This library will be aligned soon, to support cloudflare as well.
108108
## Usage in Browser
109109

110110
Here is the most minimal example on how to use this library in the browser.
111-
You need to ensure, that the webassembly file can be loaded correctly. Therefore, you need to add this as parameter to the `quickJS` call.
111+
You need to ensure that the WebAssembly file can be loaded correctly. Therefore, you must pass its location to the `loadQuickJs` call.
112112

113113
Using `fetch`is possible, but there are the same restrictions as in any other browser usage (CORS & co).
114114

website/docs/runtime-options.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ To prevent abuse, the number of running `setTimeout` and `setInterval` calls is
8181

8282
| Option | Type | Description |
8383
|--------|------|-------------|
84-
| `maxTimeoutCount` | `number` | Max concurrent timeouts (default: `100`). |
85-
| `maxIntervalCount` | `number` | Max concurrent intervals (default: `100`). |
84+
| `maxTimeoutCount` | `number` | Max concurrent timeouts (default: `10`). |
85+
| `maxIntervalCount` | `number` | Max concurrent intervals (default: `10`). |
8686

8787
---
8888

@@ -108,7 +108,7 @@ Both **synchronous** and **asynchronous** QuickJS sandboxes allow customizing mo
108108

109109
## Example Usage
110110

111-
The options are passed to the `createRuntime` method. Here is a basic example:
111+
The options are passed to the `runSandboxed` function. Here is a basic example:
112112

113113
```typescript
114114
import { type SandboxOptions, loadQuickJs } from '@sebastianwessel/quickjs'

website/docs/typescript-usage.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ If checking types is required, it should be done and handled, before using this
1414
**Requirements:**
1515

1616
- optional dependency package `typescript` must be installed on the host system
17-
- `createRuntime` option `transformTypescript` must be set to `true`
17+
- Sandbox option `transformTypescript` must be set to `true`
1818

1919
Example:
2020

2121
```typescript
22-
import { quickJS } from '@sebastianwessel/quickjs'
22+
import { loadQuickJs } from '@sebastianwessel/quickjs'
2323

24-
const { createRuntime } = await quickJS()
24+
const { runSandboxed } = await loadQuickJs()
2525

2626
const options:SandboxOptions = {
2727
transformTypescript: true, // [!code ++] enable typescript support
@@ -36,15 +36,15 @@ const options:SandboxOptions = {
3636
}
3737

3838

39-
const result = await evalCode(`
40-
import { testFn } from './test.js'
39+
const result = await runSandboxed(async ({ evalCode }) => evalCode(`
40+
import { testFn } from './test.js'
4141
4242
const t = (value:string):number=>value.length
4343
4444
console.log(t('abc'))
4545
4646
export default testFn('hello')
47-
`)
47+
`), options)
4848

4949
console.log(result) // { ok: true, data: 'hello' }
5050
// console log on host:

0 commit comments

Comments
 (0)