From d1a95c6822a92f11cc242e800dd90b85e6adb80a Mon Sep 17 00:00:00 2001 From: Jake Teton-Landis Date: Sat, 31 Aug 2024 13:26:33 -0400 Subject: [PATCH] gen doc --- .../interfaces/QuickJSAsyncFFI.md | 60 +++- .../interfaces/QuickJSFFI.md | 60 +++- doc/README.md | 58 ++-- .../classes/QuickJSAsyncContext.md | 295 ++++++++++++------ .../classes/QuickJSAsyncRuntime.md | 99 +++++- .../classes/QuickJSContext.md | 283 +++++++++++------ .../classes/QuickJSRuntime.md | 93 +++++- doc/quickjs-emscripten-core/exports.md | 48 ++- .../interfaces/AsyncRuntimeOptions.md | 16 +- .../interfaces/ContextEvalOptions.md | 10 +- .../interfaces/ContextOptions.md | 2 +- .../interfaces/JSModuleLoader.md | 2 +- .../interfaces/JSModuleLoaderAsync.md | 2 +- .../interfaces/JSModuleNormalizer.md | 4 +- .../interfaces/JSModuleNormalizerAsync.md | 2 +- .../interfaces/QuickJSAsyncFFI.md | 60 +++- .../interfaces/QuickJSFFI.md | 60 +++- .../interfaces/RuntimeOptions.md | 16 +- .../interfaces/RuntimeOptionsBase.md | 14 +- .../namespaces/errors/README.md | 1 + .../QuickJSEmptyGetOwnPropertyNames.md | 59 ++++ doc/quickjs-emscripten/README.md | 58 ++-- .../classes/QuickJSAsyncContext.md | 295 ++++++++++++------ .../classes/QuickJSAsyncRuntime.md | 99 +++++- .../classes/QuickJSContext.md | 283 +++++++++++------ .../classes/QuickJSRuntime.md | 93 +++++- doc/quickjs-emscripten/exports.md | 52 ++- .../interfaces/AsyncRuntimeOptions.md | 16 +- .../interfaces/ContextEvalOptions.md | 10 +- .../interfaces/ContextOptions.md | 2 +- .../interfaces/JSModuleLoader.md | 2 +- .../interfaces/JSModuleLoaderAsync.md | 2 +- .../interfaces/JSModuleNormalizer.md | 4 +- .../interfaces/JSModuleNormalizerAsync.md | 2 +- .../interfaces/QuickJSAsyncFFI.md | 188 ++++++----- .../interfaces/QuickJSAsyncVariant.md | 6 +- .../interfaces/QuickJSFFI.md | 60 +++- .../interfaces/QuickJSSyncVariant.md | 6 +- .../interfaces/RuntimeOptions.md | 16 +- .../interfaces/RuntimeOptionsBase.md | 14 +- .../namespaces/errors/README.md | 1 + .../QuickJSEmptyGetOwnPropertyNames.md | 59 ++++ 42 files changed, 1820 insertions(+), 692 deletions(-) create mode 100644 doc/quickjs-emscripten-core/namespaces/errors/classes/QuickJSEmptyGetOwnPropertyNames.md create mode 100644 doc/quickjs-emscripten/namespaces/errors/classes/QuickJSEmptyGetOwnPropertyNames.md diff --git a/doc/@jitl/quickjs-ffi-types/interfaces/QuickJSAsyncFFI.md b/doc/@jitl/quickjs-ffi-types/interfaces/QuickJSAsyncFFI.md index ac2b03c5..db50ca6a 100644 --- a/doc/@jitl/quickjs-ffi-types/interfaces/QuickJSAsyncFFI.md +++ b/doc/@jitl/quickjs-ffi-types/interfaces/QuickJSAsyncFFI.md @@ -37,6 +37,7 @@ library. - [QTS\_FreeVoidPointer](QuickJSAsyncFFI.md#qts-freevoidpointer) - [QTS\_GetArrayBuffer](QuickJSAsyncFFI.md#qts-getarraybuffer) - [QTS\_GetArrayBufferLength](QuickJSAsyncFFI.md#qts-getarraybufferlength) + - [QTS\_GetDebugLogEnabled](QuickJSAsyncFFI.md#qts-getdebuglogenabled) - [QTS\_GetFalse](QuickJSAsyncFFI.md#qts-getfalse) - [QTS\_GetFloat64](QuickJSAsyncFFI.md#qts-getfloat64) - [QTS\_GetGlobalObject](QuickJSAsyncFFI.md#qts-getglobalobject) @@ -81,6 +82,7 @@ library. - [QTS\_RuntimeEnableModuleLoader](QuickJSAsyncFFI.md#qts-runtimeenablemoduleloader) - [QTS\_RuntimeSetMaxStackSize](QuickJSAsyncFFI.md#qts-runtimesetmaxstacksize) - [QTS\_RuntimeSetMemoryLimit](QuickJSAsyncFFI.md#qts-runtimesetmemorylimit) + - [QTS\_SetDebugLogEnabled](QuickJSAsyncFFI.md#qts-setdebuglogenabled) - [QTS\_SetProp](QuickJSAsyncFFI.md#qts-setprop) - [QTS\_SetProp\_MaybeAsync](QuickJSAsyncFFI.md#qts-setprop-maybeasync) - [QTS\_TestStringArg](QuickJSAsyncFFI.md#qts-teststringarg) @@ -123,7 +125,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:248](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L248) +[packages/quickjs-ffi-types/src/ffi-async.ts:250](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L250) *** @@ -137,7 +139,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:246](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L246) +[packages/quickjs-ffi-types/src/ffi-async.ts:248](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L248) *** @@ -151,7 +153,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:245](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L245) +[packages/quickjs-ffi-types/src/ffi-async.ts:247](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L247) *** @@ -571,6 +573,24 @@ Set at compile time. *** +### QTS\_GetDebugLogEnabled + +> **QTS\_GetDebugLogEnabled**: (`rt`) => `number` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +#### Returns + +`number` + +#### Source + +[packages/quickjs-ffi-types/src/ffi-async.ts:245](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L245) + +*** + ### QTS\_GetFalse > **QTS\_GetFalse**: () => [`JSValueConstPointer`](../exports.md#jsvalueconstpointer) @@ -1085,7 +1105,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:247](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L247) +[packages/quickjs-ffi-types/src/ffi-async.ts:249](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L249) *** @@ -1311,7 +1331,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:253](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L253) +[packages/quickjs-ffi-types/src/ffi-async.ts:255](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L255) *** @@ -1329,7 +1349,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:255](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L255) +[packages/quickjs-ffi-types/src/ffi-async.ts:257](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L257) *** @@ -1365,7 +1385,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:252](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L252) +[packages/quickjs-ffi-types/src/ffi-async.ts:254](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L254) *** @@ -1385,7 +1405,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:254](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L254) +[packages/quickjs-ffi-types/src/ffi-async.ts:256](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L256) *** @@ -1429,6 +1449,26 @@ Set at compile time. *** +### QTS\_SetDebugLogEnabled + +> **QTS\_SetDebugLogEnabled**: (`rt`, `is_enabled`) => `void` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +• **is\_enabled**: `number` + +#### Returns + +`void` + +#### Source + +[packages/quickjs-ffi-types/src/ffi-async.ts:246](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L246) + +*** + ### QTS\_SetProp > **QTS\_SetProp**: (`ctx`, `this_val`, `prop_name`, `prop_value`) => `void` @@ -1551,7 +1591,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:260](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L260) +[packages/quickjs-ffi-types/src/ffi-async.ts:262](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L262) *** @@ -1571,7 +1611,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:256](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L256) +[packages/quickjs-ffi-types/src/ffi-async.ts:258](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L258) *** diff --git a/doc/@jitl/quickjs-ffi-types/interfaces/QuickJSFFI.md b/doc/@jitl/quickjs-ffi-types/interfaces/QuickJSFFI.md index 7158ea5d..eb92840e 100644 --- a/doc/@jitl/quickjs-ffi-types/interfaces/QuickJSFFI.md +++ b/doc/@jitl/quickjs-ffi-types/interfaces/QuickJSFFI.md @@ -33,6 +33,7 @@ library. - [QTS\_FreeVoidPointer](QuickJSFFI.md#qts-freevoidpointer) - [QTS\_GetArrayBuffer](QuickJSFFI.md#qts-getarraybuffer) - [QTS\_GetArrayBufferLength](QuickJSFFI.md#qts-getarraybufferlength) + - [QTS\_GetDebugLogEnabled](QuickJSFFI.md#qts-getdebuglogenabled) - [QTS\_GetFalse](QuickJSFFI.md#qts-getfalse) - [QTS\_GetFloat64](QuickJSFFI.md#qts-getfloat64) - [QTS\_GetGlobalObject](QuickJSFFI.md#qts-getglobalobject) @@ -73,6 +74,7 @@ library. - [QTS\_RuntimeEnableModuleLoader](QuickJSFFI.md#qts-runtimeenablemoduleloader) - [QTS\_RuntimeSetMaxStackSize](QuickJSFFI.md#qts-runtimesetmaxstacksize) - [QTS\_RuntimeSetMemoryLimit](QuickJSFFI.md#qts-runtimesetmemorylimit) + - [QTS\_SetDebugLogEnabled](QuickJSFFI.md#qts-setdebuglogenabled) - [QTS\_SetProp](QuickJSFFI.md#qts-setprop) - [QTS\_TestStringArg](QuickJSFFI.md#qts-teststringarg) - [QTS\_Throw](QuickJSFFI.md#qts-throw) @@ -114,7 +116,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:196](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L196) +[packages/quickjs-ffi-types/src/ffi.ts:198](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L198) *** @@ -128,7 +130,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L194) +[packages/quickjs-ffi-types/src/ffi.ts:196](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L196) *** @@ -142,7 +144,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:193](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L193) +[packages/quickjs-ffi-types/src/ffi.ts:195](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L195) *** @@ -466,6 +468,24 @@ Set at compile time. *** +### QTS\_GetDebugLogEnabled + +> **QTS\_GetDebugLogEnabled**: (`rt`) => `number` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +#### Returns + +`number` + +#### Source + +[packages/quickjs-ffi-types/src/ffi.ts:193](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L193) + +*** + ### QTS\_GetFalse > **QTS\_GetFalse**: () => [`JSValueConstPointer`](../exports.md#jsvalueconstpointer) @@ -890,7 +910,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:195](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L195) +[packages/quickjs-ffi-types/src/ffi.ts:197](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L197) *** @@ -1116,7 +1136,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:201](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L201) +[packages/quickjs-ffi-types/src/ffi.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L203) *** @@ -1134,7 +1154,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L203) +[packages/quickjs-ffi-types/src/ffi.ts:205](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L205) *** @@ -1170,7 +1190,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:200](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L200) +[packages/quickjs-ffi-types/src/ffi.ts:202](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L202) *** @@ -1190,7 +1210,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:202](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L202) +[packages/quickjs-ffi-types/src/ffi.ts:204](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L204) *** @@ -1234,6 +1254,26 @@ Set at compile time. *** +### QTS\_SetDebugLogEnabled + +> **QTS\_SetDebugLogEnabled**: (`rt`, `is_enabled`) => `void` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +• **is\_enabled**: `number` + +#### Returns + +`void` + +#### Source + +[packages/quickjs-ffi-types/src/ffi.ts:194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L194) + +*** + ### QTS\_SetProp > **QTS\_SetProp**: (`ctx`, `this_val`, `prop_name`, `prop_value`) => `void` @@ -1332,7 +1372,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:208](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L208) +[packages/quickjs-ffi-types/src/ffi.ts:210](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L210) *** @@ -1352,7 +1392,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:204](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L204) +[packages/quickjs-ffi-types/src/ffi.ts:206](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L206) *** diff --git a/doc/README.md b/doc/README.md index d2bae266..95a382a3 100644 --- a/doc/README.md +++ b/doc/README.md @@ -565,8 +565,9 @@ build variant of quickjs-emscripten, and also the [DEBUG_SYNC] build variant. The debug sync build variant has extra instrumentation code for detecting memory leaks. -The class [TestQuickJSWASMModule] exposes the memory leak detection API, although -this API is only accurate when using `DEBUG_SYNC` variant. +The class [TestQuickJSWASMModule] exposes the memory leak detection API, +although this API is only accurate when using `DEBUG_SYNC` variant. You can also +enable [debug logging](#debugging) to help diagnose failures. ```typescript // Define your test suite in a function, so that you can test against @@ -748,40 +749,51 @@ You can use quickjs-emscripten directly from an HTML file in two ways: ### Debugging -- Switch to a DEBUG build variant of the WebAssembly module to see debug log messages from the C part of this library: +Debug logging can be enabled globally, or for specific runtimes. You need to use a DEBUG build variant of the WebAssembly module to see debug log messages from the C part of this library. - ```typescript - import { newQuickJSWASMModule, DEBUG_SYNC } from "quickjs-emscripten" +```typescript +import { newQuickJSWASMModule, DEBUG_SYNC } from "quickjs-emscripten" + +const QuickJS = await newQuickJSWASMModule(DEBUG_SYNC) +``` + +With quickjs-emscripten-core: - const QuickJS = await newQuickJSWASMModule(DEBUG_SYNC) - ``` +```typescript +import { newQuickJSWASMModuleFromVariant } from "quickjs-emscripten-core" +import DEBUG_SYNC from "@jitl/quickjs-wasmfile-debug-sync" + +const QuickJS = await newQuickJSWASMModuleFromVariant(DEBUG_SYNC) +``` - With quickjs-emscripten-core: +To enable debug logging globally, call [setDebugMode][setDebugMode]. This affects global Javascript parts of the library, like the module loader and asyncify internals, and is inherited by runtimes created after the call. - ```typescript - import { newQuickJSWASMModuleFromVariant } from "quickjs-emscripten-core" - import DEBUG_SYNC from "@jitl/quickjs-wasmfile-debug-sync" +```typescript +import { setDebugMode } from "quickjs-emscripten" - const QuickJS = await newQuickJSWASMModuleFromVariant(DEBUG_SYNC) - ``` +setDebugMode(true) +``` -- Enable debug log messages from the Javascript part of this library with [setDebugMode][setDebugMode]: +With quickjs-emscripten-core: - ```typescript - import { setDebugMode } from "quickjs-emscripten" +```typescript +import { setDebugMode } from "quickjs-emscripten-core" - setDebugMode(true) - ``` +setDebugMode(true) +``` - With quickjs-emscripten-core: +To enable debug logging for a specific runtime, call [setDebugModeRt][setDebugModeRt]. This affects only the runtime and its associated contexts. - ```typescript - import { setDebugMode } from "quickjs-emscripten-core" +```typescript +const runtime = QuickJS.newRuntime() +runtime.setDebugMode(true) - setDebugMode(true) - ``` +const context = QuickJS.newContext() +context.runtime.setDebugMode(true) +``` [setDebugMode]: doc/quickjs-emscripten/exports.md#setdebugmode +[setDebugModeRt]: https://github.com/justjake/quickjs-emscripten/blob/main/doc/quickjs-emscripten-core/classes/QuickJSRuntime.md#setdebugmode ### Supported Platforms diff --git a/doc/quickjs-emscripten-core/classes/QuickJSAsyncContext.md b/doc/quickjs-emscripten-core/classes/QuickJSAsyncContext.md index fd74efac..2e255e60 100644 --- a/doc/quickjs-emscripten-core/classes/QuickJSAsyncContext.md +++ b/doc/quickjs-emscripten-core/classes/QuickJSAsyncContext.md @@ -29,6 +29,7 @@ host functions as though they were synchronous. - [Methods](QuickJSAsyncContext.md#methods) - [`[dispose]`()](QuickJSAsyncContext.md#dispose) - [callFunction()](QuickJSAsyncContext.md#callfunction) + - [callMethod()](QuickJSAsyncContext.md#callmethod) - [decodeBinaryJSON()](QuickJSAsyncContext.md#decodebinaryjson) - [defineProp()](QuickJSAsyncContext.md#defineprop) - [dispose()](QuickJSAsyncContext.md#dispose) @@ -43,9 +44,9 @@ host functions as though they were synchronous. - [getIterator()](QuickJSAsyncContext.md#getiterator) - [getLength()](QuickJSAsyncContext.md#getlength) - [getNumber()](QuickJSAsyncContext.md#getnumber) + - [getOwnPropertyNames()](QuickJSAsyncContext.md#getownpropertynames) - [getPromiseState()](QuickJSAsyncContext.md#getpromisestate) - [getProp()](QuickJSAsyncContext.md#getprop) - - [getPropNames()](QuickJSAsyncContext.md#getpropnames) - [getString()](QuickJSAsyncContext.md#getstring) - [getSymbol()](QuickJSAsyncContext.md#getsymbol) - [getWellKnownSymbol()](QuickJSAsyncContext.md#getwellknownsymbol) @@ -111,7 +112,7 @@ to create a new QuickJSContext. #### Source -[packages/quickjs-emscripten-core/src/context.ts:220](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L220) +[packages/quickjs-emscripten-core/src/context.ts:225](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L225) ## Properties @@ -127,7 +128,7 @@ The runtime that created this context. #### Source -[packages/quickjs-emscripten-core/src/context-asyncify.ts:32](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L32) +[packages/quickjs-emscripten-core/src/context-asyncify.ts:31](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L31) ## Accessors @@ -145,7 +146,7 @@ false after the object has been [dispose](QuickJSAsyncContext.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/context.ts:251](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L251) +[packages/quickjs-emscripten-core/src/context.ts:256](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L256) *** @@ -161,7 +162,7 @@ false after the object has been [dispose](QuickJSAsyncContext.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/context.ts:309](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L309) +[packages/quickjs-emscripten-core/src/context.ts:314](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L314) *** @@ -179,7 +180,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:324](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L324) +[packages/quickjs-emscripten-core/src/context.ts:329](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L329) *** @@ -195,7 +196,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:283](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L283) +[packages/quickjs-emscripten-core/src/context.ts:288](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L288) *** @@ -211,7 +212,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:296](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L296) +[packages/quickjs-emscripten-core/src/context.ts:301](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L301) *** @@ -227,7 +228,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:270](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L270) +[packages/quickjs-emscripten-core/src/context.ts:275](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L275) ## Methods @@ -253,9 +254,12 @@ Just calls the standard .dispose() method of this class. ### callFunction() -> **callFunction**(`func`, `thisVal`, ...`args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> +#### callFunction(func, thisVal, args) + +> **callFunction**(`func`, `thisVal`, `args`?): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> -[`func.call(thisVal, ...args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). +[`func.call(thisVal, ...args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) or +[`func.apply(thisVal, args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply). Call a JSValue as a function. See [unwrapResult](QuickJSAsyncContext.md#unwrapresult), which will throw if the function returned an error, or @@ -263,7 +267,44 @@ return the result handle directly. If evaluation returned a handle containing a promise, use [resolvePromise](QuickJSAsyncContext.md#resolvepromise) to convert it to a native promise and [runtime](QuickJSAsyncContext.md#runtime).[QuickJSRuntime#executePendingJobs](QuickJSRuntime.md#executependingjobs) to finish evaluating the promise. -#### Parameters +##### Parameters + +• **func**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **thisVal**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **args?**: [`QuickJSHandle`](../exports.md#quickjshandle)[] + +##### Returns + +`ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +A result. If the function threw synchronously, `result.error` be a +handle to the exception. Otherwise `result.value` will be a handle to the +value. + +Example: + +```typescript +using parseIntHandle = context.getProp(global, "parseInt") +using stringHandle = context.newString("42") +using resultHandle = context.callFunction(parseIntHandle, context.undefined, stringHandle).unwrap() +console.log(context.dump(resultHandle)) // 42 +``` + +##### Inherited from + +[`quickjs-emscripten-core.QuickJSContext.callFunction`](QuickJSContext.md#callfunction) + +##### Source + +[packages/quickjs-emscripten-core/src/context.ts:1060](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1060) + +#### callFunction(func, thisVal, args) + +> **callFunction**(`func`, `thisVal`, ...`args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +##### Parameters • **func**: [`QuickJSHandle`](../exports.md#quickjshandle) @@ -271,6 +312,36 @@ a promise, use [resolvePromise](QuickJSAsyncContext.md#resolvepromise) to conver • ...**args**: [`QuickJSHandle`](../exports.md#quickjshandle)[] +##### Returns + +`ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +##### Inherited from + +[`quickjs-emscripten-core.QuickJSContext.callFunction`](QuickJSContext.md#callfunction) + +##### Source + +[packages/quickjs-emscripten-core/src/context.ts:1065](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1065) + +*** + +### callMethod() + +> **callMethod**(`thisHandle`, `key`, `args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +`handle[key](...args)` + +Call a method on a JSValue. This is a convenience method that calls [getProp](QuickJSAsyncContext.md#getprop) and [callFunction](QuickJSAsyncContext.md#callfunction). + +#### Parameters + +• **thisHandle**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **key**: [`QuickJSPropertyKey`](../exports.md#quickjspropertykey) + +• **args**: [`QuickJSHandle`](../exports.md#quickjshandle)[]= `[]` + #### Returns `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> @@ -281,11 +352,11 @@ value. #### Inherited from -[`quickjs-emscripten-core.QuickJSContext.callFunction`](QuickJSContext.md#callfunction) +[`quickjs-emscripten-core.QuickJSContext.callMethod`](QuickJSContext.md#callmethod) #### Source -[packages/quickjs-emscripten-core/src/context.ts:1009](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1009) +[packages/quickjs-emscripten-core/src/context.ts:1114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1114) *** @@ -318,7 +389,7 @@ socket.on("data", chunk => { #### Source -[packages/quickjs-emscripten-core/src/context.ts:1335](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1335) +[packages/quickjs-emscripten-core/src/context.ts:1423](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1423) *** @@ -349,7 +420,7 @@ Javascript string or number (which will be converted automatically to a JSValue) #### Source -[packages/quickjs-emscripten-core/src/context.ts:960](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L960) +[packages/quickjs-emscripten-core/src/context.ts:1001](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1001) *** @@ -374,7 +445,7 @@ will result in an error. #### Source -[packages/quickjs-emscripten-core/src/context.ts:261](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L261) +[packages/quickjs-emscripten-core/src/context.ts:266](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L266) *** @@ -400,7 +471,7 @@ Returns `handle.toString()` if it cannot be serialized to JSON. #### Source -[packages/quickjs-emscripten-core/src/context.ts:1147](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1147) +[packages/quickjs-emscripten-core/src/context.ts:1235](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1235) *** @@ -434,7 +505,7 @@ socket.write(dataLifetime?.value) #### Source -[packages/quickjs-emscripten-core/src/context.ts:1318](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1318) +[packages/quickjs-emscripten-core/src/context.ts:1406](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1406) *** @@ -461,7 +532,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:807](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L807) +[packages/quickjs-emscripten-core/src/context.ts:812](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L812) *** @@ -524,7 +595,7 @@ interrupted, the error will have name `InternalError` and message #### Source -[packages/quickjs-emscripten-core/src/context.ts:1069](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1069) +[packages/quickjs-emscripten-core/src/context.ts:1157](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1157) *** @@ -550,7 +621,7 @@ See [EvalFlags](../exports.md#evalflags) for number semantics #### Source -[packages/quickjs-emscripten-core/src/context-asyncify.ts:45](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L45) +[packages/quickjs-emscripten-core/src/context-asyncify.ts:44](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L44) *** @@ -572,7 +643,7 @@ See [EvalFlags](../exports.md#evalflags) for number semantics #### Source -[packages/quickjs-emscripten-core/src/context.ts:1344](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1344) +[packages/quickjs-emscripten-core/src/context.ts:1432](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1432) *** @@ -596,7 +667,7 @@ Coverts `handle` to a JavaScript ArrayBuffer #### Source -[packages/quickjs-emscripten-core/src/context.ts:686](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L686) +[packages/quickjs-emscripten-core/src/context.ts:691](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L691) *** @@ -620,13 +691,13 @@ Converts `handle` to a Javascript bigint. #### Source -[packages/quickjs-emscripten-core/src/context.ts:677](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L677) +[packages/quickjs-emscripten-core/src/context.ts:682](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L682) *** ### getIterator() -> **getIterator**(`handle`): `ContextResult`\<`QuickJSIterator`\> +> **getIterator**(`iterableHandle`): `ContextResult`\<`QuickJSIterator`\> `handle[Symbol.iterator]()`. See [QuickJSIterator]([object Object]). Returns a host iterator that wraps and proxies calls to a guest iterator handle. @@ -635,20 +706,16 @@ Once the iterator is done, the handle is automatically disposed, and the iterato is considered done if the handle is disposed. ```typescript -for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) { - const nextHandle = context.unwrapResult(nextResult) - try { - // Do something with nextHandle - console.log(context.dump(nextHandle)) - } finally { - nextHandle.dispose() - } +for (using entriesHandle of context.getIterator(mapHandle).unwrap()) { + using keyHandle = context.getProp(entriesHandle, 0) + using valueHandle = context.getProp(entriesHandle, 1) + console.log(context.dump(keyHandle), '->', context.dump(valueHandle)) } ``` #### Parameters -• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) +• **iterableHandle**: [`QuickJSHandle`](../exports.md#quickjshandle) #### Returns @@ -660,7 +727,7 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) #### Source -[packages/quickjs-emscripten-core/src/context.ts:920](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L920) +[packages/quickjs-emscripten-core/src/context.ts:961](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L961) *** @@ -668,7 +735,16 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) > **getLength**(`handle`): `undefined` \| `number` -`handle.length`. +`handle.length` as a host number. + +Example use: +```typescript +const length = context.getLength(arrayHandle) ?? 0 +for (let i = 0; i < length; i++) { + using value = context.getProp(arrayHandle, i) + console.log(`array[${i}] =`, context.dump(value)) +} +``` #### Parameters @@ -678,13 +754,15 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) `undefined` \| `number` +a number if the handle has a numeric length property, otherwise `undefined`. + #### Inherited from [`quickjs-emscripten-core.QuickJSContext.getLength`](QuickJSContext.md#getlength) #### Source -[packages/quickjs-emscripten-core/src/context.ts:855](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L855) +[packages/quickjs-emscripten-core/src/context.ts:871](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L871) *** @@ -710,7 +788,61 @@ Converts `handle` into a Javascript number. #### Source -[packages/quickjs-emscripten-core/src/context.ts:648](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L648) +[packages/quickjs-emscripten-core/src/context.ts:653](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L653) + +*** + +### getOwnPropertyNames() + +> **getOwnPropertyNames**(`handle`, `options`): `ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`QuickJSHandle`](../exports.md#quickjshandle)\>\> + +`Object.getOwnPropertyNames(handle)`. +Similar to the [standard semantics](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames), +but with extra, non-standard options for: + +- fetching array indexes as numbers (`numbers: true`) +- including symbols (`symbols: true`) +- only iterating over enumerable properties (`onlyEnumerable: true`) + +The default behavior is to emulate the standard: +```typescript +context.getOwnPropertyNames(handle, { strings: true, numbersAsStrings: true }) +``` + +Note when passing an explicit options object, you must set at least one +option, and `strings` are not included unless specified. + +Example use: +```typescript +for (using prop of context.getOwnPropertyNames(objectHandle).unwrap()) { + using value = context.getProp(handle, prop) + console.log(context.dump(prop), '->', context.dump(value)) +} +``` + +#### Parameters + +• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **options**: `GetOwnPropertyNamesOptions`= `undefined` + +#### Returns + +`ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`QuickJSHandle`](../exports.md#quickjshandle)\>\> + +an an array of handles of the property names. The array itself is disposable for your convenience. + +#### Inherited from + +[`quickjs-emscripten-core.QuickJSContext.getOwnPropertyNames`](QuickJSContext.md#getownpropertynames) + +#### Throws + +QuickJSEmptyGetOwnPropertyNames if no options are set. + +#### Source + +[packages/quickjs-emscripten-core/src/context.ts:908](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L908) *** @@ -744,7 +876,7 @@ resultHandle.dispose(); #### Source -[packages/quickjs-emscripten-core/src/context.ts:711](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L711) +[packages/quickjs-emscripten-core/src/context.ts:716](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L716) *** @@ -774,34 +906,7 @@ Javascript string (which will be converted automatically). #### Source -[packages/quickjs-emscripten-core/src/context.ts:836](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L836) - -*** - -### getPropNames() - -> **getPropNames**(`handle`, `options`): `ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`JSValue`](../exports.md#jsvalue)\>\> - -`Object.getOwnPropertyNames(handle)`. -Similar to the [standard semantics](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames). - -#### Parameters - -• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) - -• **options**: `GetOwnPropertyNamesOptions` - -#### Returns - -`ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`JSValue`](../exports.md#jsvalue)\>\> - -#### Inherited from - -[`quickjs-emscripten-core.QuickJSContext.getPropNames`](QuickJSContext.md#getpropnames) - -#### Source - -[packages/quickjs-emscripten-core/src/context.ts:868](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L868) +[packages/quickjs-emscripten-core/src/context.ts:841](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L841) *** @@ -825,7 +930,7 @@ Converts `handle` to a Javascript string. #### Source -[packages/quickjs-emscripten-core/src/context.ts:656](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L656) +[packages/quickjs-emscripten-core/src/context.ts:661](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L661) *** @@ -850,7 +955,7 @@ registry in the guest, it will be created with Symbol.for on the host. #### Source -[packages/quickjs-emscripten-core/src/context.ts:665](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L665) +[packages/quickjs-emscripten-core/src/context.ts:670](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L670) *** @@ -874,7 +979,7 @@ Access a well-known symbol that is a property of the global Symbol object, like #### Source -[packages/quickjs-emscripten-core/src/context.ts:384](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L384) +[packages/quickjs-emscripten-core/src/context.ts:389](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L389) *** @@ -895,7 +1000,7 @@ Create a new QuickJS [array](https://developer.mozilla.org/en-US/docs/Web/JavaSc #### Source -[packages/quickjs-emscripten-core/src/context.ts:426](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L426) +[packages/quickjs-emscripten-core/src/context.ts:431](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L431) *** @@ -919,7 +1024,7 @@ Create a new QuickJS [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/ #### Source -[packages/quickjs-emscripten-core/src/context.ts:434](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L434) +[packages/quickjs-emscripten-core/src/context.ts:439](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L439) *** @@ -951,7 +1056,7 @@ See [Emscripten's docs on Asyncify](https://emscripten.org/docs/porting/asyncify #### Source -[packages/quickjs-emscripten-core/src/context-asyncify.ts:92](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L92) +[packages/quickjs-emscripten-core/src/context-asyncify.ts:91](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L91) *** @@ -975,7 +1080,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip #### Source -[packages/quickjs-emscripten-core/src/context.ts:392](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L392) +[packages/quickjs-emscripten-core/src/context.ts:397](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L397) *** @@ -1003,7 +1108,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:603](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L603) +[packages/quickjs-emscripten-core/src/context.ts:608](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L608) #### newError(message) @@ -1023,7 +1128,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:604](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L604) +[packages/quickjs-emscripten-core/src/context.ts:609](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L609) #### newError(undefined) @@ -1039,7 +1144,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:605](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L605) +[packages/quickjs-emscripten-core/src/context.ts:610](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L610) *** @@ -1156,7 +1261,7 @@ return deferred.handle #### Source -[packages/quickjs-emscripten-core/src/context.ts:597](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L597) +[packages/quickjs-emscripten-core/src/context.ts:602](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L602) *** @@ -1180,7 +1285,7 @@ Converts a Javascript number into a QuickJS value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:343](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L343) +[packages/quickjs-emscripten-core/src/context.ts:348](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L348) *** @@ -1207,7 +1312,7 @@ Like [`Object.create`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/R #### Source -[packages/quickjs-emscripten-core/src/context.ts:412](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L412) +[packages/quickjs-emscripten-core/src/context.ts:417](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L417) *** @@ -1232,7 +1337,7 @@ resources; see the documentation on [QuickJSDeferredPromise](QuickJSDeferredProm ##### Source -[packages/quickjs-emscripten-core/src/context.ts:447](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L447) +[packages/quickjs-emscripten-core/src/context.ts:452](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L452) #### newPromise(promise) @@ -1258,7 +1363,7 @@ You can still resolve/reject the created promise "early" using its methods. ##### Source -[packages/quickjs-emscripten-core/src/context.ts:455](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L455) +[packages/quickjs-emscripten-core/src/context.ts:460](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L460) #### newPromise(newPromiseFn) @@ -1283,7 +1388,7 @@ You can still resolve/reject the created promise "early" using its methods. ##### Source -[packages/quickjs-emscripten-core/src/context.ts:462](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L462) +[packages/quickjs-emscripten-core/src/context.ts:467](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L467) *** @@ -1307,7 +1412,7 @@ Create a QuickJS [string](https://developer.mozilla.org/en-US/docs/Web/JavaScrip #### Source -[packages/quickjs-emscripten-core/src/context.ts:350](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L350) +[packages/quickjs-emscripten-core/src/context.ts:355](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L355) *** @@ -1332,7 +1437,7 @@ All symbols created with the same key will be the same value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:373](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L373) +[packages/quickjs-emscripten-core/src/context.ts:378](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L378) *** @@ -1357,7 +1462,7 @@ No two symbols created with this function will be the same value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:361](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L361) +[packages/quickjs-emscripten-core/src/context.ts:366](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L366) *** @@ -1389,7 +1494,7 @@ You may need to call [runtime](QuickJSAsyncContext.md#runtime).[QuickJSRuntime#e #### Source -[packages/quickjs-emscripten-core/src/context.ts:750](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L750) +[packages/quickjs-emscripten-core/src/context.ts:755](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L755) *** @@ -1416,7 +1521,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:815](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L815) +[packages/quickjs-emscripten-core/src/context.ts:820](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L820) *** @@ -1443,7 +1548,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:823](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L823) +[packages/quickjs-emscripten-core/src/context.ts:828](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L828) *** @@ -1480,7 +1585,7 @@ properties. #### Source -[packages/quickjs-emscripten-core/src/context.ts:945](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L945) +[packages/quickjs-emscripten-core/src/context.ts:986](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L986) *** @@ -1506,7 +1611,7 @@ properties. #### Source -[packages/quickjs-emscripten-core/src/context.ts:1340](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1340) +[packages/quickjs-emscripten-core/src/context.ts:1428](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1428) *** @@ -1530,7 +1635,7 @@ Throw an error in the VM, interrupted whatever current execution is in progress #### Source -[packages/quickjs-emscripten-core/src/context.ts:1106](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1106) +[packages/quickjs-emscripten-core/src/context.ts:1194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1194) *** @@ -1558,7 +1663,7 @@ Does not support BigInt values correctly. #### Source -[packages/quickjs-emscripten-core/src/context.ts:639](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L639) +[packages/quickjs-emscripten-core/src/context.ts:644](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L644) *** @@ -1589,7 +1694,7 @@ If the result is an error, converts the error to a native object and throws the #### Source -[packages/quickjs-emscripten-core/src/context.ts:1190](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1190) +[packages/quickjs-emscripten-core/src/context.ts:1278](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1278) *** diff --git a/doc/quickjs-emscripten-core/classes/QuickJSAsyncRuntime.md b/doc/quickjs-emscripten-core/classes/QuickJSAsyncRuntime.md index 73a83341..d6c4945f 100644 --- a/doc/quickjs-emscripten-core/classes/QuickJSAsyncRuntime.md +++ b/doc/quickjs-emscripten-core/classes/QuickJSAsyncRuntime.md @@ -41,13 +41,16 @@ Configure ES module loading with [setModuleLoader](QuickJSAsyncRuntime.md#setmod - [`[dispose]`()](QuickJSAsyncRuntime.md#dispose) - [assertOwned()](QuickJSAsyncRuntime.md#assertowned) - [computeMemoryUsage()](QuickJSAsyncRuntime.md#computememoryusage) + - [debugLog()](QuickJSAsyncRuntime.md#debuglog) - [dispose()](QuickJSAsyncRuntime.md#dispose) - [dumpMemoryUsage()](QuickJSAsyncRuntime.md#dumpmemoryusage) - [executePendingJobs()](QuickJSAsyncRuntime.md#executependingjobs) - [hasPendingJob()](QuickJSAsyncRuntime.md#haspendingjob) + - [isDebugMode()](QuickJSAsyncRuntime.md#isdebugmode) - [newContext()](QuickJSAsyncRuntime.md#newcontext) - [removeInterruptHandler()](QuickJSAsyncRuntime.md#removeinterrupthandler) - [removeModuleLoader()](QuickJSAsyncRuntime.md#removemoduleloader) + - [setDebugMode()](QuickJSAsyncRuntime.md#setdebugmode) - [setInterruptHandler()](QuickJSAsyncRuntime.md#setinterrupthandler) - [setMaxStackSize()](QuickJSAsyncRuntime.md#setmaxstacksize) - [setMemoryLimit()](QuickJSAsyncRuntime.md#setmemorylimit) @@ -93,7 +96,7 @@ false after the object has been [dispose](QuickJSAsyncRuntime.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:121](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L121) +[packages/quickjs-emscripten-core/src/runtime.ts:125](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L125) ## Methods @@ -141,7 +144,7 @@ QuickJSWrongOwner if owned by a different runtime. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:323](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L323) +[packages/quickjs-emscripten-core/src/runtime.ts:327](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L327) *** @@ -165,7 +168,34 @@ For a human-digestible representation, see [dumpMemoryUsage](QuickJSAsyncRuntime #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:292](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L292) +[packages/quickjs-emscripten-core/src/runtime.ts:296](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L296) + +*** + +### debugLog() + +> **debugLog**(...`msg`): `void` + +In debug mode, log the result of calling `msg()`. + +We take a function instead of a log message to avoid expensive string +manipulation if debug logging is disabled. + +#### Parameters + +• ...**msg**: `unknown`[] + +#### Returns + +`void` + +#### Inherited from + +[`quickjs-emscripten-core.QuickJSRuntime.debugLog`](QuickJSRuntime.md#debuglog) + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:363](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L363) *** @@ -185,7 +215,7 @@ Dispose of the underlying resources used by this object. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:125](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L125) +[packages/quickjs-emscripten-core/src/runtime.ts:129](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L129) *** @@ -206,7 +236,7 @@ For programmatic access to this information, see [computeMemoryUsage](QuickJSAsy #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:303](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L303) +[packages/quickjs-emscripten-core/src/runtime.ts:307](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L307) *** @@ -244,7 +274,7 @@ functions or rejected promises. Those errors are available by calling #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:239](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L239) +[packages/quickjs-emscripten-core/src/runtime.ts:243](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L243) *** @@ -267,7 +297,27 @@ true if there is at least one pendingJob queued up. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:190](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L190) +[packages/quickjs-emscripten-core/src/runtime.ts:194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L194) + +*** + +### isDebugMode() + +> **isDebugMode**(): `boolean` + +#### Returns + +`boolean` + +true if debug logging is enabled + +#### Inherited from + +[`quickjs-emscripten-core.QuickJSRuntime.isDebugMode`](QuickJSRuntime.md#isdebugmode) + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:353](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L353) *** @@ -316,7 +366,7 @@ See [setInterruptHandler](QuickJSAsyncRuntime.md#setinterrupthandler). #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:215](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L215) +[packages/quickjs-emscripten-core/src/runtime.ts:219](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L219) *** @@ -336,7 +386,34 @@ Remove the the loader set by [setModuleLoader](QuickJSAsyncRuntime.md#setmodulel #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:177](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L177) +[packages/quickjs-emscripten-core/src/runtime.ts:181](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L181) + +*** + +### setDebugMode() + +> **setDebugMode**(`enabled`): `void` + +Enable or disable debug logging. + +If this module is a DEBUG variant, more logs will be printed from the C +code. + +#### Parameters + +• **enabled**: `boolean` + +#### Returns + +`void` + +#### Inherited from + +[`quickjs-emscripten-core.QuickJSRuntime.setDebugMode`](QuickJSRuntime.md#setdebugmode) + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:343](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L343) *** @@ -364,7 +441,7 @@ The interrupt handler can be removed with [removeInterruptHandler](QuickJSAsyncR #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L203) +[packages/quickjs-emscripten-core/src/runtime.ts:207](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L207) *** @@ -417,7 +494,7 @@ To remove the limit, set to `-1`. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:277](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L277) +[packages/quickjs-emscripten-core/src/runtime.ts:281](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L281) *** diff --git a/doc/quickjs-emscripten-core/classes/QuickJSContext.md b/doc/quickjs-emscripten-core/classes/QuickJSContext.md index e6379d1a..abe39f70 100644 --- a/doc/quickjs-emscripten-core/classes/QuickJSContext.md +++ b/doc/quickjs-emscripten-core/classes/QuickJSContext.md @@ -54,6 +54,7 @@ See [QuickJSRuntime](QuickJSRuntime.md) for more information. - [Methods](QuickJSContext.md#methods) - [`[dispose]`()](QuickJSContext.md#dispose) - [callFunction()](QuickJSContext.md#callfunction) + - [callMethod()](QuickJSContext.md#callmethod) - [decodeBinaryJSON()](QuickJSContext.md#decodebinaryjson) - [defineProp()](QuickJSContext.md#defineprop) - [dispose()](QuickJSContext.md#dispose) @@ -67,9 +68,9 @@ See [QuickJSRuntime](QuickJSRuntime.md) for more information. - [getIterator()](QuickJSContext.md#getiterator) - [getLength()](QuickJSContext.md#getlength) - [getNumber()](QuickJSContext.md#getnumber) + - [getOwnPropertyNames()](QuickJSContext.md#getownpropertynames) - [getPromiseState()](QuickJSContext.md#getpromisestate) - [getProp()](QuickJSContext.md#getprop) - - [getPropNames()](QuickJSContext.md#getpropnames) - [getString()](QuickJSContext.md#getstring) - [getSymbol()](QuickJSContext.md#getsymbol) - [getWellKnownSymbol()](QuickJSContext.md#getwellknownsymbol) @@ -139,7 +140,7 @@ to create a new QuickJSContext. #### Source -[packages/quickjs-emscripten-core/src/context.ts:220](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L220) +[packages/quickjs-emscripten-core/src/context.ts:225](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L225) ## Properties @@ -151,7 +152,7 @@ The runtime that created this context. #### Source -[packages/quickjs-emscripten-core/src/context.ts:182](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L182) +[packages/quickjs-emscripten-core/src/context.ts:187](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L187) ## Accessors @@ -169,7 +170,7 @@ false after the object has been [dispose](QuickJSContext.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/context.ts:251](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L251) +[packages/quickjs-emscripten-core/src/context.ts:256](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L256) *** @@ -185,7 +186,7 @@ false after the object has been [dispose](QuickJSContext.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/context.ts:309](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L309) +[packages/quickjs-emscripten-core/src/context.ts:314](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L314) *** @@ -203,7 +204,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:324](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L324) +[packages/quickjs-emscripten-core/src/context.ts:329](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L329) *** @@ -219,7 +220,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:283](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L283) +[packages/quickjs-emscripten-core/src/context.ts:288](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L288) *** @@ -235,7 +236,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:296](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L296) +[packages/quickjs-emscripten-core/src/context.ts:301](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L301) *** @@ -251,7 +252,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:270](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L270) +[packages/quickjs-emscripten-core/src/context.ts:275](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L275) ## Methods @@ -281,9 +282,12 @@ Just calls the standard .dispose() method of this class. ### callFunction() -> **callFunction**(`func`, `thisVal`, ...`args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> +#### callFunction(func, thisVal, args) + +> **callFunction**(`func`, `thisVal`, `args`?): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> -[`func.call(thisVal, ...args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). +[`func.call(thisVal, ...args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) or +[`func.apply(thisVal, args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply). Call a JSValue as a function. See [unwrapResult](QuickJSContext.md#unwrapresult), which will throw if the function returned an error, or @@ -291,15 +295,15 @@ return the result handle directly. If evaluation returned a handle containing a promise, use [resolvePromise](QuickJSContext.md#resolvepromise) to convert it to a native promise and [runtime](QuickJSContext.md#runtime).[QuickJSRuntime#executePendingJobs](QuickJSRuntime.md#executependingjobs) to finish evaluating the promise. -#### Parameters +##### Parameters • **func**: [`QuickJSHandle`](../exports.md#quickjshandle) • **thisVal**: [`QuickJSHandle`](../exports.md#quickjshandle) -• ...**args**: [`QuickJSHandle`](../exports.md#quickjshandle)[] +• **args?**: [`QuickJSHandle`](../exports.md#quickjshandle)[] -#### Returns +##### Returns `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> @@ -307,13 +311,76 @@ A result. If the function threw synchronously, `result.error` be a handle to the exception. Otherwise `result.value` will be a handle to the value. -#### Implementation of +Example: + +```typescript +using parseIntHandle = context.getProp(global, "parseInt") +using stringHandle = context.newString("42") +using resultHandle = context.callFunction(parseIntHandle, context.undefined, stringHandle).unwrap() +console.log(context.dump(resultHandle)) // 42 +``` + +##### Implementation of [`quickjs-emscripten-core.LowLevelJavascriptVm.callFunction`](../interfaces/LowLevelJavascriptVm.md#callfunction) +##### Source + +[packages/quickjs-emscripten-core/src/context.ts:1060](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1060) + +#### callFunction(func, thisVal, args) + +> **callFunction**(`func`, `thisVal`, ...`args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +##### Parameters + +• **func**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **thisVal**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• ...**args**: [`QuickJSHandle`](../exports.md#quickjshandle)[] + +##### Returns + +`ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +##### Implementation of + +`LowLevelJavascriptVm.callFunction` + +##### Source + +[packages/quickjs-emscripten-core/src/context.ts:1065](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1065) + +*** + +### callMethod() + +> **callMethod**(`thisHandle`, `key`, `args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +`handle[key](...args)` + +Call a method on a JSValue. This is a convenience method that calls [getProp](QuickJSContext.md#getprop) and [callFunction](QuickJSContext.md#callfunction). + +#### Parameters + +• **thisHandle**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **key**: [`QuickJSPropertyKey`](../exports.md#quickjspropertykey) + +• **args**: [`QuickJSHandle`](../exports.md#quickjshandle)[]= `[]` + +#### Returns + +`ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +A result. If the function threw synchronously, `result.error` be a +handle to the exception. Otherwise `result.value` will be a handle to the +value. + #### Source -[packages/quickjs-emscripten-core/src/context.ts:1009](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1009) +[packages/quickjs-emscripten-core/src/context.ts:1114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1114) *** @@ -342,7 +409,7 @@ socket.on("data", chunk => { #### Source -[packages/quickjs-emscripten-core/src/context.ts:1335](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1335) +[packages/quickjs-emscripten-core/src/context.ts:1423](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1423) *** @@ -373,7 +440,7 @@ Javascript string or number (which will be converted automatically to a JSValue) #### Source -[packages/quickjs-emscripten-core/src/context.ts:960](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L960) +[packages/quickjs-emscripten-core/src/context.ts:1001](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1001) *** @@ -402,7 +469,7 @@ will result in an error. #### Source -[packages/quickjs-emscripten-core/src/context.ts:261](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L261) +[packages/quickjs-emscripten-core/src/context.ts:266](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L266) *** @@ -424,7 +491,7 @@ Returns `handle.toString()` if it cannot be serialized to JSON. #### Source -[packages/quickjs-emscripten-core/src/context.ts:1147](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1147) +[packages/quickjs-emscripten-core/src/context.ts:1235](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1235) *** @@ -454,7 +521,7 @@ socket.write(dataLifetime?.value) #### Source -[packages/quickjs-emscripten-core/src/context.ts:1318](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1318) +[packages/quickjs-emscripten-core/src/context.ts:1406](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1406) *** @@ -477,7 +544,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:807](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L807) +[packages/quickjs-emscripten-core/src/context.ts:812](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L812) *** @@ -540,7 +607,7 @@ interrupted, the error will have name `InternalError` and message #### Source -[packages/quickjs-emscripten-core/src/context.ts:1069](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1069) +[packages/quickjs-emscripten-core/src/context.ts:1157](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1157) *** @@ -558,7 +625,7 @@ interrupted, the error will have name `InternalError` and message #### Source -[packages/quickjs-emscripten-core/src/context.ts:1344](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1344) +[packages/quickjs-emscripten-core/src/context.ts:1432](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1432) *** @@ -578,7 +645,7 @@ Coverts `handle` to a JavaScript ArrayBuffer #### Source -[packages/quickjs-emscripten-core/src/context.ts:686](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L686) +[packages/quickjs-emscripten-core/src/context.ts:691](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L691) *** @@ -598,13 +665,13 @@ Converts `handle` to a Javascript bigint. #### Source -[packages/quickjs-emscripten-core/src/context.ts:677](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L677) +[packages/quickjs-emscripten-core/src/context.ts:682](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L682) *** ### getIterator() -> **getIterator**(`handle`): `ContextResult`\<`QuickJSIterator`\> +> **getIterator**(`iterableHandle`): `ContextResult`\<`QuickJSIterator`\> `handle[Symbol.iterator]()`. See [QuickJSIterator]([object Object]). Returns a host iterator that wraps and proxies calls to a guest iterator handle. @@ -613,20 +680,16 @@ Once the iterator is done, the handle is automatically disposed, and the iterato is considered done if the handle is disposed. ```typescript -for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) { - const nextHandle = context.unwrapResult(nextResult) - try { - // Do something with nextHandle - console.log(context.dump(nextHandle)) - } finally { - nextHandle.dispose() - } +for (using entriesHandle of context.getIterator(mapHandle).unwrap()) { + using keyHandle = context.getProp(entriesHandle, 0) + using valueHandle = context.getProp(entriesHandle, 1) + console.log(context.dump(keyHandle), '->', context.dump(valueHandle)) } ``` #### Parameters -• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) +• **iterableHandle**: [`QuickJSHandle`](../exports.md#quickjshandle) #### Returns @@ -634,7 +697,7 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) #### Source -[packages/quickjs-emscripten-core/src/context.ts:920](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L920) +[packages/quickjs-emscripten-core/src/context.ts:961](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L961) *** @@ -642,7 +705,16 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) > **getLength**(`handle`): `undefined` \| `number` -`handle.length`. +`handle.length` as a host number. + +Example use: +```typescript +const length = context.getLength(arrayHandle) ?? 0 +for (let i = 0; i < length; i++) { + using value = context.getProp(arrayHandle, i) + console.log(`array[${i}] =`, context.dump(value)) +} +``` #### Parameters @@ -652,9 +724,11 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) `undefined` \| `number` +a number if the handle has a numeric length property, otherwise `undefined`. + #### Source -[packages/quickjs-emscripten-core/src/context.ts:855](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L855) +[packages/quickjs-emscripten-core/src/context.ts:871](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L871) *** @@ -680,7 +754,57 @@ Converts `handle` into a Javascript number. #### Source -[packages/quickjs-emscripten-core/src/context.ts:648](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L648) +[packages/quickjs-emscripten-core/src/context.ts:653](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L653) + +*** + +### getOwnPropertyNames() + +> **getOwnPropertyNames**(`handle`, `options`): `ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`QuickJSHandle`](../exports.md#quickjshandle)\>\> + +`Object.getOwnPropertyNames(handle)`. +Similar to the [standard semantics](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames), +but with extra, non-standard options for: + +- fetching array indexes as numbers (`numbers: true`) +- including symbols (`symbols: true`) +- only iterating over enumerable properties (`onlyEnumerable: true`) + +The default behavior is to emulate the standard: +```typescript +context.getOwnPropertyNames(handle, { strings: true, numbersAsStrings: true }) +``` + +Note when passing an explicit options object, you must set at least one +option, and `strings` are not included unless specified. + +Example use: +```typescript +for (using prop of context.getOwnPropertyNames(objectHandle).unwrap()) { + using value = context.getProp(handle, prop) + console.log(context.dump(prop), '->', context.dump(value)) +} +``` + +#### Parameters + +• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **options**: `GetOwnPropertyNamesOptions`= `undefined` + +#### Returns + +`ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`QuickJSHandle`](../exports.md#quickjshandle)\>\> + +an an array of handles of the property names. The array itself is disposable for your convenience. + +#### Throws + +QuickJSEmptyGetOwnPropertyNames if no options are set. + +#### Source + +[packages/quickjs-emscripten-core/src/context.ts:908](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L908) *** @@ -710,7 +834,7 @@ resultHandle.dispose(); #### Source -[packages/quickjs-emscripten-core/src/context.ts:711](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L711) +[packages/quickjs-emscripten-core/src/context.ts:716](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L716) *** @@ -740,30 +864,7 @@ Javascript string (which will be converted automatically). #### Source -[packages/quickjs-emscripten-core/src/context.ts:836](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L836) - -*** - -### getPropNames() - -> **getPropNames**(`handle`, `options`): `ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`JSValue`](../exports.md#jsvalue)\>\> - -`Object.getOwnPropertyNames(handle)`. -Similar to the [standard semantics](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames). - -#### Parameters - -• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) - -• **options**: `GetOwnPropertyNamesOptions` - -#### Returns - -`ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`JSValue`](../exports.md#jsvalue)\>\> - -#### Source - -[packages/quickjs-emscripten-core/src/context.ts:868](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L868) +[packages/quickjs-emscripten-core/src/context.ts:841](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L841) *** @@ -787,7 +888,7 @@ Converts `handle` to a Javascript string. #### Source -[packages/quickjs-emscripten-core/src/context.ts:656](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L656) +[packages/quickjs-emscripten-core/src/context.ts:661](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L661) *** @@ -808,7 +909,7 @@ registry in the guest, it will be created with Symbol.for on the host. #### Source -[packages/quickjs-emscripten-core/src/context.ts:665](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L665) +[packages/quickjs-emscripten-core/src/context.ts:670](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L670) *** @@ -828,7 +929,7 @@ Access a well-known symbol that is a property of the global Symbol object, like #### Source -[packages/quickjs-emscripten-core/src/context.ts:384](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L384) +[packages/quickjs-emscripten-core/src/context.ts:389](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L389) *** @@ -845,7 +946,7 @@ Create a new QuickJS [array](https://developer.mozilla.org/en-US/docs/Web/JavaSc #### Source -[packages/quickjs-emscripten-core/src/context.ts:426](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L426) +[packages/quickjs-emscripten-core/src/context.ts:431](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L431) *** @@ -865,7 +966,7 @@ Create a new QuickJS [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/ #### Source -[packages/quickjs-emscripten-core/src/context.ts:434](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L434) +[packages/quickjs-emscripten-core/src/context.ts:439](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L439) *** @@ -885,7 +986,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip #### Source -[packages/quickjs-emscripten-core/src/context.ts:392](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L392) +[packages/quickjs-emscripten-core/src/context.ts:397](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L397) *** @@ -909,7 +1010,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:603](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L603) +[packages/quickjs-emscripten-core/src/context.ts:608](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L608) #### newError(message) @@ -925,7 +1026,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:604](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L604) +[packages/quickjs-emscripten-core/src/context.ts:609](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L609) #### newError(undefined) @@ -937,7 +1038,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:605](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L605) +[packages/quickjs-emscripten-core/src/context.ts:610](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L610) *** @@ -1054,7 +1155,7 @@ return deferred.handle #### Source -[packages/quickjs-emscripten-core/src/context.ts:597](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L597) +[packages/quickjs-emscripten-core/src/context.ts:602](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L602) *** @@ -1078,7 +1179,7 @@ Converts a Javascript number into a QuickJS value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:343](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L343) +[packages/quickjs-emscripten-core/src/context.ts:348](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L348) *** @@ -1105,7 +1206,7 @@ Like [`Object.create`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/R #### Source -[packages/quickjs-emscripten-core/src/context.ts:412](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L412) +[packages/quickjs-emscripten-core/src/context.ts:417](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L417) *** @@ -1126,7 +1227,7 @@ resources; see the documentation on [QuickJSDeferredPromise](QuickJSDeferredProm ##### Source -[packages/quickjs-emscripten-core/src/context.ts:447](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L447) +[packages/quickjs-emscripten-core/src/context.ts:452](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L452) #### newPromise(promise) @@ -1148,7 +1249,7 @@ You can still resolve/reject the created promise "early" using its methods. ##### Source -[packages/quickjs-emscripten-core/src/context.ts:455](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L455) +[packages/quickjs-emscripten-core/src/context.ts:460](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L460) #### newPromise(newPromiseFn) @@ -1169,7 +1270,7 @@ You can still resolve/reject the created promise "early" using its methods. ##### Source -[packages/quickjs-emscripten-core/src/context.ts:462](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L462) +[packages/quickjs-emscripten-core/src/context.ts:467](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L467) *** @@ -1193,7 +1294,7 @@ Create a QuickJS [string](https://developer.mozilla.org/en-US/docs/Web/JavaScrip #### Source -[packages/quickjs-emscripten-core/src/context.ts:350](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L350) +[packages/quickjs-emscripten-core/src/context.ts:355](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L355) *** @@ -1214,7 +1315,7 @@ All symbols created with the same key will be the same value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:373](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L373) +[packages/quickjs-emscripten-core/src/context.ts:378](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L378) *** @@ -1235,7 +1336,7 @@ No two symbols created with this function will be the same value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:361](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L361) +[packages/quickjs-emscripten-core/src/context.ts:366](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L366) *** @@ -1263,7 +1364,7 @@ You may need to call [runtime](QuickJSContext.md#runtime).[QuickJSRuntime#execut #### Source -[packages/quickjs-emscripten-core/src/context.ts:750](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L750) +[packages/quickjs-emscripten-core/src/context.ts:755](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L755) *** @@ -1286,7 +1387,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:815](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L815) +[packages/quickjs-emscripten-core/src/context.ts:820](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L820) *** @@ -1309,7 +1410,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:823](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L823) +[packages/quickjs-emscripten-core/src/context.ts:828](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L828) *** @@ -1346,7 +1447,7 @@ properties. #### Source -[packages/quickjs-emscripten-core/src/context.ts:945](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L945) +[packages/quickjs-emscripten-core/src/context.ts:986](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L986) *** @@ -1368,7 +1469,7 @@ properties. #### Source -[packages/quickjs-emscripten-core/src/context.ts:1340](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1340) +[packages/quickjs-emscripten-core/src/context.ts:1428](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1428) *** @@ -1388,7 +1489,7 @@ Throw an error in the VM, interrupted whatever current execution is in progress #### Source -[packages/quickjs-emscripten-core/src/context.ts:1106](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1106) +[packages/quickjs-emscripten-core/src/context.ts:1194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1194) *** @@ -1416,7 +1517,7 @@ Does not support BigInt values correctly. #### Source -[packages/quickjs-emscripten-core/src/context.ts:639](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L639) +[packages/quickjs-emscripten-core/src/context.ts:644](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L644) *** @@ -1443,7 +1544,7 @@ If the result is an error, converts the error to a native object and throws the #### Source -[packages/quickjs-emscripten-core/src/context.ts:1190](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1190) +[packages/quickjs-emscripten-core/src/context.ts:1278](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1278) *** diff --git a/doc/quickjs-emscripten-core/classes/QuickJSRuntime.md b/doc/quickjs-emscripten-core/classes/QuickJSRuntime.md index 2edee6de..f8bf2eff 100644 --- a/doc/quickjs-emscripten-core/classes/QuickJSRuntime.md +++ b/doc/quickjs-emscripten-core/classes/QuickJSRuntime.md @@ -42,13 +42,16 @@ Configure ES module loading with [setModuleLoader](QuickJSRuntime.md#setmodulelo - [`[dispose]`()](QuickJSRuntime.md#dispose) - [assertOwned()](QuickJSRuntime.md#assertowned) - [computeMemoryUsage()](QuickJSRuntime.md#computememoryusage) + - [debugLog()](QuickJSRuntime.md#debuglog) - [dispose()](QuickJSRuntime.md#dispose) - [dumpMemoryUsage()](QuickJSRuntime.md#dumpmemoryusage) - [executePendingJobs()](QuickJSRuntime.md#executependingjobs) - [hasPendingJob()](QuickJSRuntime.md#haspendingjob) + - [isDebugMode()](QuickJSRuntime.md#isdebugmode) - [newContext()](QuickJSRuntime.md#newcontext) - [removeInterruptHandler()](QuickJSRuntime.md#removeinterrupthandler) - [removeModuleLoader()](QuickJSRuntime.md#removemoduleloader) + - [setDebugMode()](QuickJSRuntime.md#setdebugmode) - [setInterruptHandler()](QuickJSRuntime.md#setinterrupthandler) - [setMaxStackSize()](QuickJSRuntime.md#setmaxstacksize) - [setMemoryLimit()](QuickJSRuntime.md#setmemorylimit) @@ -94,7 +97,7 @@ false after the object has been [dispose](QuickJSRuntime.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:121](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L121) +[packages/quickjs-emscripten-core/src/runtime.ts:125](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L125) ## Methods @@ -142,7 +145,7 @@ QuickJSWrongOwner if owned by a different runtime. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:323](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L323) +[packages/quickjs-emscripten-core/src/runtime.ts:327](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L327) *** @@ -162,7 +165,30 @@ For a human-digestible representation, see [dumpMemoryUsage](QuickJSRuntime.md#d #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:292](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L292) +[packages/quickjs-emscripten-core/src/runtime.ts:296](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L296) + +*** + +### debugLog() + +> **debugLog**(...`msg`): `void` + +In debug mode, log the result of calling `msg()`. + +We take a function instead of a log message to avoid expensive string +manipulation if debug logging is disabled. + +#### Parameters + +• ...**msg**: `unknown`[] + +#### Returns + +`void` + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:363](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L363) *** @@ -186,7 +212,7 @@ Dispose of the underlying resources used by this object. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:125](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L125) +[packages/quickjs-emscripten-core/src/runtime.ts:129](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L129) *** @@ -203,7 +229,7 @@ For programmatic access to this information, see [computeMemoryUsage](QuickJSRun #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:303](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L303) +[packages/quickjs-emscripten-core/src/runtime.ts:307](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L307) *** @@ -237,7 +263,7 @@ functions or rejected promises. Those errors are available by calling #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:239](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L239) +[packages/quickjs-emscripten-core/src/runtime.ts:243](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L243) *** @@ -256,7 +282,23 @@ true if there is at least one pendingJob queued up. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:190](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L190) +[packages/quickjs-emscripten-core/src/runtime.ts:194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L194) + +*** + +### isDebugMode() + +> **isDebugMode**(): `boolean` + +#### Returns + +`boolean` + +true if debug logging is enabled + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:353](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L353) *** @@ -280,7 +322,7 @@ You should dispose a created context before disposing this runtime. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:136](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L136) +[packages/quickjs-emscripten-core/src/runtime.ts:140](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L140) *** @@ -297,7 +339,7 @@ See [setInterruptHandler](QuickJSRuntime.md#setinterrupthandler). #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:215](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L215) +[packages/quickjs-emscripten-core/src/runtime.ts:219](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L219) *** @@ -313,7 +355,30 @@ Remove the the loader set by [setModuleLoader](QuickJSRuntime.md#setmoduleloader #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:177](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L177) +[packages/quickjs-emscripten-core/src/runtime.ts:181](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L181) + +*** + +### setDebugMode() + +> **setDebugMode**(`enabled`): `void` + +Enable or disable debug logging. + +If this module is a DEBUG variant, more logs will be printed from the C +code. + +#### Parameters + +• **enabled**: `boolean` + +#### Returns + +`void` + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:343](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L343) *** @@ -337,7 +402,7 @@ The interrupt handler can be removed with [removeInterruptHandler](QuickJSRuntim #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L203) +[packages/quickjs-emscripten-core/src/runtime.ts:207](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L207) *** @@ -358,7 +423,7 @@ To remove the limit, set to `0`. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:311](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L311) +[packages/quickjs-emscripten-core/src/runtime.ts:315](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L315) *** @@ -379,7 +444,7 @@ To remove the limit, set to `-1`. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:277](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L277) +[packages/quickjs-emscripten-core/src/runtime.ts:281](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L281) *** @@ -404,7 +469,7 @@ The loader can be removed with [removeModuleLoader](QuickJSRuntime.md#removemodu #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:168](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L168) +[packages/quickjs-emscripten-core/src/runtime.ts:172](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L172) *** diff --git a/doc/quickjs-emscripten-core/exports.md b/doc/quickjs-emscripten-core/exports.md index 939f1b2b..ae015ee7 100644 --- a/doc/quickjs-emscripten-core/exports.md +++ b/doc/quickjs-emscripten-core/exports.md @@ -74,6 +74,7 @@ - [newQuickJSAsyncWASMModuleFromVariant()](exports.md#newquickjsasyncwasmmodulefromvariant) - [newQuickJSWASMModuleFromVariant()](exports.md#newquickjswasmmodulefromvariant) - [newVariant()](exports.md#newvariant) + - [setDebugMode()](exports.md#setdebugmode) - [shouldInterruptAfterDeadline()](exports.md#shouldinterruptafterdeadline) ## Namespaces @@ -146,7 +147,7 @@ #### Source -[packages/quickjs-emscripten-core/src/context-asyncify.ts:19](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L19) +[packages/quickjs-emscripten-core/src/context-asyncify.ts:18](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L18) *** @@ -337,7 +338,7 @@ Language features that can be enabled or disabled in a QuickJSContext. #### Source -[packages/quickjs-emscripten-core/src/types.ts:145](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L145) +[packages/quickjs-emscripten-core/src/types.ts:146](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L146) *** @@ -396,7 +397,7 @@ for the Emscripten stack. #### Source -[packages/quickjs-emscripten-core/src/types.ts:68](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L68) +[packages/quickjs-emscripten-core/src/types.ts:69](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L69) *** @@ -406,7 +407,7 @@ for the Emscripten stack. #### Source -[packages/quickjs-emscripten-core/src/types.ts:69](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L69) +[packages/quickjs-emscripten-core/src/types.ts:70](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L70) *** @@ -416,7 +417,7 @@ for the Emscripten stack. #### Source -[packages/quickjs-emscripten-core/src/types.ts:67](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L67) +[packages/quickjs-emscripten-core/src/types.ts:68](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L68) *** @@ -426,7 +427,7 @@ for the Emscripten stack. #### Source -[packages/quickjs-emscripten-core/src/types.ts:86](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L86) +[packages/quickjs-emscripten-core/src/types.ts:87](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L87) *** @@ -436,7 +437,7 @@ for the Emscripten stack. #### Source -[packages/quickjs-emscripten-core/src/types.ts:87](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L87) +[packages/quickjs-emscripten-core/src/types.ts:88](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L88) *** @@ -446,7 +447,7 @@ for the Emscripten stack. #### Source -[packages/quickjs-emscripten-core/src/types.ts:85](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L85) +[packages/quickjs-emscripten-core/src/types.ts:86](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L86) *** @@ -653,7 +654,7 @@ for the Emscripten stack. #### Source -[packages/quickjs-emscripten-core/src/types.ts:332](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L332) +[packages/quickjs-emscripten-core/src/types.ts:333](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L333) *** @@ -719,7 +720,7 @@ You must dispose of any handles you create by calling the `.dispose()` method. #### Source -[packages/quickjs-emscripten-core/src/types.ts:52](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L52) +[packages/quickjs-emscripten-core/src/types.ts:53](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L53) *** @@ -732,7 +733,7 @@ Property key for getting or setting a property on a handle with #### Source -[packages/quickjs-emscripten-core/src/context.ts:64](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L64) +[packages/quickjs-emscripten-core/src/context.ts:69](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L69) *** @@ -894,7 +895,7 @@ The default [Intrinsics](exports.md#intrinsics) language features enabled in a Q #### Source -[packages/quickjs-emscripten-core/src/types.ts:172](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L172) +[packages/quickjs-emscripten-core/src/types.ts:173](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L173) *** @@ -1383,6 +1384,29 @@ This may be necessary in Cloudflare Workers, which can't compile WebAssembly mod *** +### setDebugMode() + +> **setDebugMode**(`enabled`): `void` + +Enable (or disable) debug logging and object creation tracking globally. +This setting is inherited by newly created QuickJSRuntime instances. +To get debug logging in the WebAssembly module, you need to use a debug build variant. +See [the quickjs-emscripten-core README](https://github.com/justjake/quickjs-emscripten/tree/main/doc/quickjs-emscripten-core) for more about build variants. + +#### Parameters + +• **enabled**: `boolean`= `true` + +#### Returns + +`void` + +#### Source + +[packages/quickjs-emscripten-core/src/debug.ts:13](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/debug.ts#L13) + +*** + ### shouldInterruptAfterDeadline() > **shouldInterruptAfterDeadline**(`deadline`): [`InterruptHandler`](exports.md#interrupthandler) diff --git a/doc/quickjs-emscripten-core/interfaces/AsyncRuntimeOptions.md b/doc/quickjs-emscripten-core/interfaces/AsyncRuntimeOptions.md index 16527266..252d061a 100644 --- a/doc/quickjs-emscripten-core/interfaces/AsyncRuntimeOptions.md +++ b/doc/quickjs-emscripten-core/interfaces/AsyncRuntimeOptions.md @@ -35,7 +35,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) +[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) *** @@ -49,7 +49,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:112](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L112) +[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) *** @@ -63,7 +63,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) +[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) *** @@ -77,7 +77,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) +[packages/quickjs-emscripten-core/src/types.ts:115](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L115) *** @@ -87,7 +87,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:136](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L136) +[packages/quickjs-emscripten-core/src/types.ts:137](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L137) *** @@ -101,7 +101,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:116](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L116) +[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) *** @@ -115,7 +115,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) +[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) *** @@ -129,7 +129,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) +[packages/quickjs-emscripten-core/src/types.ts:120](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L120) *** diff --git a/doc/quickjs-emscripten-core/interfaces/ContextEvalOptions.md b/doc/quickjs-emscripten-core/interfaces/ContextEvalOptions.md index bd85cec7..1781940d 100644 --- a/doc/quickjs-emscripten-core/interfaces/ContextEvalOptions.md +++ b/doc/quickjs-emscripten-core/interfaces/ContextEvalOptions.md @@ -25,7 +25,7 @@ don't include the stack frames before this eval in the Error() backtraces #### Source -[packages/quickjs-emscripten-core/src/types.ts:262](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L262) +[packages/quickjs-emscripten-core/src/types.ts:263](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L263) *** @@ -39,7 +39,7 @@ with JS_EvalFunction(). #### Source -[packages/quickjs-emscripten-core/src/types.ts:260](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L260) +[packages/quickjs-emscripten-core/src/types.ts:261](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L261) *** @@ -51,7 +51,7 @@ Force "strict" mode #### Source -[packages/quickjs-emscripten-core/src/types.ts:252](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L252) +[packages/quickjs-emscripten-core/src/types.ts:253](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L253) *** @@ -63,7 +63,7 @@ Force "strip" mode #### Source -[packages/quickjs-emscripten-core/src/types.ts:254](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L254) +[packages/quickjs-emscripten-core/src/types.ts:255](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L255) *** @@ -78,7 +78,7 @@ Global code (default), or "module" code? #### Source -[packages/quickjs-emscripten-core/src/types.ts:250](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L250) +[packages/quickjs-emscripten-core/src/types.ts:251](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L251) *** diff --git a/doc/quickjs-emscripten-core/interfaces/ContextOptions.md b/doc/quickjs-emscripten-core/interfaces/ContextOptions.md index 5ad0f015..0c3cf454 100644 --- a/doc/quickjs-emscripten-core/interfaces/ContextOptions.md +++ b/doc/quickjs-emscripten-core/interfaces/ContextOptions.md @@ -37,7 +37,7 @@ const contextWithoutDateOrEval = runtime.newContext({ #### Source -[packages/quickjs-emscripten-core/src/types.ts:228](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L228) +[packages/quickjs-emscripten-core/src/types.ts:229](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L229) *** diff --git a/doc/quickjs-emscripten-core/interfaces/JSModuleLoader.md b/doc/quickjs-emscripten-core/interfaces/JSModuleLoader.md index e27f43e3..1faf3a53 100644 --- a/doc/quickjs-emscripten-core/interfaces/JSModuleLoader.md +++ b/doc/quickjs-emscripten-core/interfaces/JSModuleLoader.md @@ -22,7 +22,7 @@ Load module (sync) ## Source -[packages/quickjs-emscripten-core/src/types.ts:82](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L82) +[packages/quickjs-emscripten-core/src/types.ts:83](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L83) *** diff --git a/doc/quickjs-emscripten-core/interfaces/JSModuleLoaderAsync.md b/doc/quickjs-emscripten-core/interfaces/JSModuleLoaderAsync.md index a0972daa..01a7be19 100644 --- a/doc/quickjs-emscripten-core/interfaces/JSModuleLoaderAsync.md +++ b/doc/quickjs-emscripten-core/interfaces/JSModuleLoaderAsync.md @@ -22,7 +22,7 @@ Load module (async) ## Source -[packages/quickjs-emscripten-core/src/types.ts:75](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L75) +[packages/quickjs-emscripten-core/src/types.ts:76](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L76) *** diff --git a/doc/quickjs-emscripten-core/interfaces/JSModuleNormalizer.md b/doc/quickjs-emscripten-core/interfaces/JSModuleNormalizer.md index 0d292926..a7f0bae8 100644 --- a/doc/quickjs-emscripten-core/interfaces/JSModuleNormalizer.md +++ b/doc/quickjs-emscripten-core/interfaces/JSModuleNormalizer.md @@ -26,7 +26,7 @@ ## Source -[packages/quickjs-emscripten-core/src/types.ts:99](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L99) +[packages/quickjs-emscripten-core/src/types.ts:100](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L100) > **JSModuleNormalizer**(`baseModuleName`, `requestedName`, `vm`): [`JSModuleNormalizeResult`](../exports.md#jsmodulenormalizeresult) \| `Promise`\<[`JSModuleNormalizeResult`](../exports.md#jsmodulenormalizeresult)\> @@ -44,7 +44,7 @@ ## Source -[packages/quickjs-emscripten-core/src/types.ts:92](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L92) +[packages/quickjs-emscripten-core/src/types.ts:93](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L93) *** diff --git a/doc/quickjs-emscripten-core/interfaces/JSModuleNormalizerAsync.md b/doc/quickjs-emscripten-core/interfaces/JSModuleNormalizerAsync.md index 477ba6db..87171ee9 100644 --- a/doc/quickjs-emscripten-core/interfaces/JSModuleNormalizerAsync.md +++ b/doc/quickjs-emscripten-core/interfaces/JSModuleNormalizerAsync.md @@ -26,7 +26,7 @@ ## Source -[packages/quickjs-emscripten-core/src/types.ts:92](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L92) +[packages/quickjs-emscripten-core/src/types.ts:93](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L93) *** diff --git a/doc/quickjs-emscripten-core/interfaces/QuickJSAsyncFFI.md b/doc/quickjs-emscripten-core/interfaces/QuickJSAsyncFFI.md index ea771a48..cbcad748 100644 --- a/doc/quickjs-emscripten-core/interfaces/QuickJSAsyncFFI.md +++ b/doc/quickjs-emscripten-core/interfaces/QuickJSAsyncFFI.md @@ -37,6 +37,7 @@ library. - [QTS\_FreeVoidPointer](QuickJSAsyncFFI.md#qts-freevoidpointer) - [QTS\_GetArrayBuffer](QuickJSAsyncFFI.md#qts-getarraybuffer) - [QTS\_GetArrayBufferLength](QuickJSAsyncFFI.md#qts-getarraybufferlength) + - [QTS\_GetDebugLogEnabled](QuickJSAsyncFFI.md#qts-getdebuglogenabled) - [QTS\_GetFalse](QuickJSAsyncFFI.md#qts-getfalse) - [QTS\_GetFloat64](QuickJSAsyncFFI.md#qts-getfloat64) - [QTS\_GetGlobalObject](QuickJSAsyncFFI.md#qts-getglobalobject) @@ -81,6 +82,7 @@ library. - [QTS\_RuntimeEnableModuleLoader](QuickJSAsyncFFI.md#qts-runtimeenablemoduleloader) - [QTS\_RuntimeSetMaxStackSize](QuickJSAsyncFFI.md#qts-runtimesetmaxstacksize) - [QTS\_RuntimeSetMemoryLimit](QuickJSAsyncFFI.md#qts-runtimesetmemorylimit) + - [QTS\_SetDebugLogEnabled](QuickJSAsyncFFI.md#qts-setdebuglogenabled) - [QTS\_SetProp](QuickJSAsyncFFI.md#qts-setprop) - [QTS\_SetProp\_MaybeAsync](QuickJSAsyncFFI.md#qts-setprop-maybeasync) - [QTS\_TestStringArg](QuickJSAsyncFFI.md#qts-teststringarg) @@ -123,7 +125,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:248](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L248) +[packages/quickjs-ffi-types/src/ffi-async.ts:250](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L250) *** @@ -137,7 +139,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:246](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L246) +[packages/quickjs-ffi-types/src/ffi-async.ts:248](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L248) *** @@ -151,7 +153,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:245](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L245) +[packages/quickjs-ffi-types/src/ffi-async.ts:247](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L247) *** @@ -571,6 +573,24 @@ Set at compile time. *** +### QTS\_GetDebugLogEnabled + +> **QTS\_GetDebugLogEnabled**: (`rt`) => `number` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +#### Returns + +`number` + +#### Source + +[packages/quickjs-ffi-types/src/ffi-async.ts:245](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L245) + +*** + ### QTS\_GetFalse > **QTS\_GetFalse**: () => [`JSValueConstPointer`](../exports.md#jsvalueconstpointer) @@ -1085,7 +1105,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:247](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L247) +[packages/quickjs-ffi-types/src/ffi-async.ts:249](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L249) *** @@ -1311,7 +1331,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:253](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L253) +[packages/quickjs-ffi-types/src/ffi-async.ts:255](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L255) *** @@ -1329,7 +1349,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:255](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L255) +[packages/quickjs-ffi-types/src/ffi-async.ts:257](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L257) *** @@ -1365,7 +1385,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:252](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L252) +[packages/quickjs-ffi-types/src/ffi-async.ts:254](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L254) *** @@ -1385,7 +1405,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:254](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L254) +[packages/quickjs-ffi-types/src/ffi-async.ts:256](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L256) *** @@ -1429,6 +1449,26 @@ Set at compile time. *** +### QTS\_SetDebugLogEnabled + +> **QTS\_SetDebugLogEnabled**: (`rt`, `is_enabled`) => `void` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +• **is\_enabled**: `number` + +#### Returns + +`void` + +#### Source + +[packages/quickjs-ffi-types/src/ffi-async.ts:246](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L246) + +*** + ### QTS\_SetProp > **QTS\_SetProp**: (`ctx`, `this_val`, `prop_name`, `prop_value`) => `void` @@ -1551,7 +1591,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:260](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L260) +[packages/quickjs-ffi-types/src/ffi-async.ts:262](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L262) *** @@ -1571,7 +1611,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi-async.ts:256](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L256) +[packages/quickjs-ffi-types/src/ffi-async.ts:258](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi-async.ts#L258) *** diff --git a/doc/quickjs-emscripten-core/interfaces/QuickJSFFI.md b/doc/quickjs-emscripten-core/interfaces/QuickJSFFI.md index a963ebc9..4251716a 100644 --- a/doc/quickjs-emscripten-core/interfaces/QuickJSFFI.md +++ b/doc/quickjs-emscripten-core/interfaces/QuickJSFFI.md @@ -33,6 +33,7 @@ library. - [QTS\_FreeVoidPointer](QuickJSFFI.md#qts-freevoidpointer) - [QTS\_GetArrayBuffer](QuickJSFFI.md#qts-getarraybuffer) - [QTS\_GetArrayBufferLength](QuickJSFFI.md#qts-getarraybufferlength) + - [QTS\_GetDebugLogEnabled](QuickJSFFI.md#qts-getdebuglogenabled) - [QTS\_GetFalse](QuickJSFFI.md#qts-getfalse) - [QTS\_GetFloat64](QuickJSFFI.md#qts-getfloat64) - [QTS\_GetGlobalObject](QuickJSFFI.md#qts-getglobalobject) @@ -73,6 +74,7 @@ library. - [QTS\_RuntimeEnableModuleLoader](QuickJSFFI.md#qts-runtimeenablemoduleloader) - [QTS\_RuntimeSetMaxStackSize](QuickJSFFI.md#qts-runtimesetmaxstacksize) - [QTS\_RuntimeSetMemoryLimit](QuickJSFFI.md#qts-runtimesetmemorylimit) + - [QTS\_SetDebugLogEnabled](QuickJSFFI.md#qts-setdebuglogenabled) - [QTS\_SetProp](QuickJSFFI.md#qts-setprop) - [QTS\_TestStringArg](QuickJSFFI.md#qts-teststringarg) - [QTS\_Throw](QuickJSFFI.md#qts-throw) @@ -114,7 +116,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:196](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L196) +[packages/quickjs-ffi-types/src/ffi.ts:198](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L198) *** @@ -128,7 +130,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L194) +[packages/quickjs-ffi-types/src/ffi.ts:196](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L196) *** @@ -142,7 +144,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:193](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L193) +[packages/quickjs-ffi-types/src/ffi.ts:195](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L195) *** @@ -466,6 +468,24 @@ Set at compile time. *** +### QTS\_GetDebugLogEnabled + +> **QTS\_GetDebugLogEnabled**: (`rt`) => `number` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +#### Returns + +`number` + +#### Source + +[packages/quickjs-ffi-types/src/ffi.ts:193](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L193) + +*** + ### QTS\_GetFalse > **QTS\_GetFalse**: () => [`JSValueConstPointer`](../exports.md#jsvalueconstpointer) @@ -890,7 +910,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:195](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L195) +[packages/quickjs-ffi-types/src/ffi.ts:197](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L197) *** @@ -1116,7 +1136,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:201](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L201) +[packages/quickjs-ffi-types/src/ffi.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L203) *** @@ -1134,7 +1154,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L203) +[packages/quickjs-ffi-types/src/ffi.ts:205](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L205) *** @@ -1170,7 +1190,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:200](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L200) +[packages/quickjs-ffi-types/src/ffi.ts:202](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L202) *** @@ -1190,7 +1210,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:202](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L202) +[packages/quickjs-ffi-types/src/ffi.ts:204](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L204) *** @@ -1234,6 +1254,26 @@ Set at compile time. *** +### QTS\_SetDebugLogEnabled + +> **QTS\_SetDebugLogEnabled**: (`rt`, `is_enabled`) => `void` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +• **is\_enabled**: `number` + +#### Returns + +`void` + +#### Source + +[packages/quickjs-ffi-types/src/ffi.ts:194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L194) + +*** + ### QTS\_SetProp > **QTS\_SetProp**: (`ctx`, `this_val`, `prop_name`, `prop_value`) => `void` @@ -1332,7 +1372,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:208](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L208) +[packages/quickjs-ffi-types/src/ffi.ts:210](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L210) *** @@ -1352,7 +1392,7 @@ Set at compile time. #### Source -[packages/quickjs-ffi-types/src/ffi.ts:204](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L204) +[packages/quickjs-ffi-types/src/ffi.ts:206](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-ffi-types/src/ffi.ts#L206) *** diff --git a/doc/quickjs-emscripten-core/interfaces/RuntimeOptions.md b/doc/quickjs-emscripten-core/interfaces/RuntimeOptions.md index e8e84c0c..28800342 100644 --- a/doc/quickjs-emscripten-core/interfaces/RuntimeOptions.md +++ b/doc/quickjs-emscripten-core/interfaces/RuntimeOptions.md @@ -35,7 +35,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) +[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) *** @@ -49,7 +49,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:112](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L112) +[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) *** @@ -63,7 +63,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) +[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) *** @@ -77,7 +77,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) +[packages/quickjs-emscripten-core/src/types.ts:115](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L115) *** @@ -87,7 +87,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:132](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L132) +[packages/quickjs-emscripten-core/src/types.ts:133](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L133) *** @@ -101,7 +101,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:116](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L116) +[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) *** @@ -115,7 +115,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) +[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) *** @@ -129,7 +129,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) +[packages/quickjs-emscripten-core/src/types.ts:120](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L120) *** diff --git a/doc/quickjs-emscripten-core/interfaces/RuntimeOptionsBase.md b/doc/quickjs-emscripten-core/interfaces/RuntimeOptionsBase.md index 24f45834..bc775a17 100644 --- a/doc/quickjs-emscripten-core/interfaces/RuntimeOptionsBase.md +++ b/doc/quickjs-emscripten-core/interfaces/RuntimeOptionsBase.md @@ -31,7 +31,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) +[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) *** @@ -41,7 +41,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:112](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L112) +[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) *** @@ -51,7 +51,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) +[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) *** @@ -61,7 +61,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) +[packages/quickjs-emscripten-core/src/types.ts:115](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L115) *** @@ -71,7 +71,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:116](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L116) +[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) *** @@ -81,7 +81,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) +[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) *** @@ -91,7 +91,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) +[packages/quickjs-emscripten-core/src/types.ts:120](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L120) *** diff --git a/doc/quickjs-emscripten-core/namespaces/errors/README.md b/doc/quickjs-emscripten-core/namespaces/errors/README.md index fed5caa8..46c855dd 100644 --- a/doc/quickjs-emscripten-core/namespaces/errors/README.md +++ b/doc/quickjs-emscripten-core/namespaces/errors/README.md @@ -14,6 +14,7 @@ Collects the informative errors this library may throw. - [QuickJSAsyncifyError](classes/QuickJSAsyncifyError.md) - [QuickJSAsyncifySuspended](classes/QuickJSAsyncifySuspended.md) +- [QuickJSEmptyGetOwnPropertyNames](classes/QuickJSEmptyGetOwnPropertyNames.md) - [QuickJSEmscriptenModuleError](classes/QuickJSEmscriptenModuleError.md) - [QuickJSMemoryLeakDetected](classes/QuickJSMemoryLeakDetected.md) - [QuickJSNotImplemented](classes/QuickJSNotImplemented.md) diff --git a/doc/quickjs-emscripten-core/namespaces/errors/classes/QuickJSEmptyGetOwnPropertyNames.md b/doc/quickjs-emscripten-core/namespaces/errors/classes/QuickJSEmptyGetOwnPropertyNames.md new file mode 100644 index 00000000..3a6e4a62 --- /dev/null +++ b/doc/quickjs-emscripten-core/namespaces/errors/classes/QuickJSEmptyGetOwnPropertyNames.md @@ -0,0 +1,59 @@ +[quickjs-emscripten](../../../../packages.md) • **quickjs-emscripten-core** • [Readme](../../../README.md) \| [Exports](../../../exports.md) + +*** + +[quickjs-emscripten](../../../../packages.md) / [quickjs-emscripten-core](../../../exports.md) / [errors](../README.md) / QuickJSEmptyGetOwnPropertyNames + +# Class: QuickJSEmptyGetOwnPropertyNames + +## Contents + +- [Extends](QuickJSEmptyGetOwnPropertyNames.md#extends) +- [Constructors](QuickJSEmptyGetOwnPropertyNames.md#constructors) + - [new QuickJSEmptyGetOwnPropertyNames(message)](QuickJSEmptyGetOwnPropertyNames.md#new-quickjsemptygetownpropertynamesmessage) +- [Properties](QuickJSEmptyGetOwnPropertyNames.md#properties) + - [name](QuickJSEmptyGetOwnPropertyNames.md#name) + +## Extends + +- `Error` + +## Constructors + +### new QuickJSEmptyGetOwnPropertyNames(message) + +> **new QuickJSEmptyGetOwnPropertyNames**(`message`?): [`QuickJSEmptyGetOwnPropertyNames`](QuickJSEmptyGetOwnPropertyNames.md) + +#### Parameters + +• **message?**: `string` + +#### Returns + +[`QuickJSEmptyGetOwnPropertyNames`](QuickJSEmptyGetOwnPropertyNames.md) + +#### Inherited from + +`Error.constructor` + +#### Source + +node\_modules/typescript/lib/lib.es5.d.ts:1081 + +## Properties + +### name + +> **name**: `string` = `"QuickJSEmptyGetOwnPropertyNames"` + +#### Overrides + +`Error.name` + +#### Source + +[packages/quickjs-emscripten-core/src/errors.ts:53](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/errors.ts#L53) + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/) diff --git a/doc/quickjs-emscripten/README.md b/doc/quickjs-emscripten/README.md index 3c48582e..025b8e45 100644 --- a/doc/quickjs-emscripten/README.md +++ b/doc/quickjs-emscripten/README.md @@ -585,8 +585,9 @@ build variant of quickjs-emscripten, and also the [DEBUG_SYNC] build variant. The debug sync build variant has extra instrumentation code for detecting memory leaks. -The class [TestQuickJSWASMModule] exposes the memory leak detection API, although -this API is only accurate when using `DEBUG_SYNC` variant. +The class [TestQuickJSWASMModule] exposes the memory leak detection API, +although this API is only accurate when using `DEBUG_SYNC` variant. You can also +enable [debug logging](#debugging) to help diagnose failures. ```typescript // Define your test suite in a function, so that you can test against @@ -768,40 +769,51 @@ You can use quickjs-emscripten directly from an HTML file in two ways: ### Debugging -- Switch to a DEBUG build variant of the WebAssembly module to see debug log messages from the C part of this library: +Debug logging can be enabled globally, or for specific runtimes. You need to use a DEBUG build variant of the WebAssembly module to see debug log messages from the C part of this library. - ```typescript - import { newQuickJSWASMModule, DEBUG_SYNC } from "quickjs-emscripten" +```typescript +import { newQuickJSWASMModule, DEBUG_SYNC } from "quickjs-emscripten" + +const QuickJS = await newQuickJSWASMModule(DEBUG_SYNC) +``` + +With quickjs-emscripten-core: - const QuickJS = await newQuickJSWASMModule(DEBUG_SYNC) - ``` +```typescript +import { newQuickJSWASMModuleFromVariant } from "quickjs-emscripten-core" +import DEBUG_SYNC from "@jitl/quickjs-wasmfile-debug-sync" + +const QuickJS = await newQuickJSWASMModuleFromVariant(DEBUG_SYNC) +``` - With quickjs-emscripten-core: +To enable debug logging globally, call [setDebugMode][setDebugMode]. This affects global Javascript parts of the library, like the module loader and asyncify internals, and is inherited by runtimes created after the call. - ```typescript - import { newQuickJSWASMModuleFromVariant } from "quickjs-emscripten-core" - import DEBUG_SYNC from "@jitl/quickjs-wasmfile-debug-sync" +```typescript +import { setDebugMode } from "quickjs-emscripten" - const QuickJS = await newQuickJSWASMModuleFromVariant(DEBUG_SYNC) - ``` +setDebugMode(true) +``` -- Enable debug log messages from the Javascript part of this library with [setDebugMode][setDebugMode]: +With quickjs-emscripten-core: - ```typescript - import { setDebugMode } from "quickjs-emscripten" +```typescript +import { setDebugMode } from "quickjs-emscripten-core" - setDebugMode(true) - ``` +setDebugMode(true) +``` - With quickjs-emscripten-core: +To enable debug logging for a specific runtime, call [setDebugModeRt][setDebugModeRt]. This affects only the runtime and its associated contexts. - ```typescript - import { setDebugMode } from "quickjs-emscripten-core" +```typescript +const runtime = QuickJS.newRuntime() +runtime.setDebugMode(true) - setDebugMode(true) - ``` +const context = QuickJS.newContext() +context.runtime.setDebugMode(true) +``` [setDebugMode]: doc/quickjs-emscripten/exports.md#setdebugmode +[setDebugModeRt]: https://github.com/justjake/quickjs-emscripten/blob/main/doc/quickjs-emscripten-core/classes/QuickJSRuntime.md#setdebugmode ### Supported Platforms diff --git a/doc/quickjs-emscripten/classes/QuickJSAsyncContext.md b/doc/quickjs-emscripten/classes/QuickJSAsyncContext.md index c284544a..37f91d36 100644 --- a/doc/quickjs-emscripten/classes/QuickJSAsyncContext.md +++ b/doc/quickjs-emscripten/classes/QuickJSAsyncContext.md @@ -29,6 +29,7 @@ host functions as though they were synchronous. - [Methods](QuickJSAsyncContext.md#methods) - [`[dispose]`()](QuickJSAsyncContext.md#dispose) - [callFunction()](QuickJSAsyncContext.md#callfunction) + - [callMethod()](QuickJSAsyncContext.md#callmethod) - [decodeBinaryJSON()](QuickJSAsyncContext.md#decodebinaryjson) - [defineProp()](QuickJSAsyncContext.md#defineprop) - [dispose()](QuickJSAsyncContext.md#dispose) @@ -43,9 +44,9 @@ host functions as though they were synchronous. - [getIterator()](QuickJSAsyncContext.md#getiterator) - [getLength()](QuickJSAsyncContext.md#getlength) - [getNumber()](QuickJSAsyncContext.md#getnumber) + - [getOwnPropertyNames()](QuickJSAsyncContext.md#getownpropertynames) - [getPromiseState()](QuickJSAsyncContext.md#getpromisestate) - [getProp()](QuickJSAsyncContext.md#getprop) - - [getPropNames()](QuickJSAsyncContext.md#getpropnames) - [getString()](QuickJSAsyncContext.md#getstring) - [getSymbol()](QuickJSAsyncContext.md#getsymbol) - [getWellKnownSymbol()](QuickJSAsyncContext.md#getwellknownsymbol) @@ -111,7 +112,7 @@ to create a new QuickJSContext. #### Source -[packages/quickjs-emscripten-core/src/context.ts:220](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L220) +[packages/quickjs-emscripten-core/src/context.ts:225](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L225) ## Properties @@ -127,7 +128,7 @@ The runtime that created this context. #### Source -[packages/quickjs-emscripten-core/src/context-asyncify.ts:32](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L32) +[packages/quickjs-emscripten-core/src/context-asyncify.ts:31](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L31) ## Accessors @@ -145,7 +146,7 @@ false after the object has been [dispose](QuickJSAsyncContext.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/context.ts:251](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L251) +[packages/quickjs-emscripten-core/src/context.ts:256](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L256) *** @@ -161,7 +162,7 @@ false after the object has been [dispose](QuickJSAsyncContext.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/context.ts:309](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L309) +[packages/quickjs-emscripten-core/src/context.ts:314](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L314) *** @@ -179,7 +180,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:324](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L324) +[packages/quickjs-emscripten-core/src/context.ts:329](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L329) *** @@ -195,7 +196,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:283](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L283) +[packages/quickjs-emscripten-core/src/context.ts:288](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L288) *** @@ -211,7 +212,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:296](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L296) +[packages/quickjs-emscripten-core/src/context.ts:301](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L301) *** @@ -227,7 +228,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:270](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L270) +[packages/quickjs-emscripten-core/src/context.ts:275](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L275) ## Methods @@ -253,9 +254,12 @@ Just calls the standard .dispose() method of this class. ### callFunction() -> **callFunction**(`func`, `thisVal`, ...`args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> +#### callFunction(func, thisVal, args) + +> **callFunction**(`func`, `thisVal`, `args`?): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> -[`func.call(thisVal, ...args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). +[`func.call(thisVal, ...args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) or +[`func.apply(thisVal, args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply). Call a JSValue as a function. See [unwrapResult](QuickJSAsyncContext.md#unwrapresult), which will throw if the function returned an error, or @@ -263,7 +267,44 @@ return the result handle directly. If evaluation returned a handle containing a promise, use [resolvePromise](QuickJSAsyncContext.md#resolvepromise) to convert it to a native promise and [runtime](QuickJSAsyncContext.md#runtime).[QuickJSRuntime#executePendingJobs](QuickJSRuntime.md#executependingjobs) to finish evaluating the promise. -#### Parameters +##### Parameters + +• **func**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **thisVal**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **args?**: [`QuickJSHandle`](../exports.md#quickjshandle)[] + +##### Returns + +`ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +A result. If the function threw synchronously, `result.error` be a +handle to the exception. Otherwise `result.value` will be a handle to the +value. + +Example: + +```typescript +using parseIntHandle = context.getProp(global, "parseInt") +using stringHandle = context.newString("42") +using resultHandle = context.callFunction(parseIntHandle, context.undefined, stringHandle).unwrap() +console.log(context.dump(resultHandle)) // 42 +``` + +##### Inherited from + +[`quickjs-emscripten.QuickJSContext.callFunction`](QuickJSContext.md#callfunction) + +##### Source + +[packages/quickjs-emscripten-core/src/context.ts:1060](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1060) + +#### callFunction(func, thisVal, args) + +> **callFunction**(`func`, `thisVal`, ...`args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +##### Parameters • **func**: [`QuickJSHandle`](../exports.md#quickjshandle) @@ -271,6 +312,36 @@ a promise, use [resolvePromise](QuickJSAsyncContext.md#resolvepromise) to conver • ...**args**: [`QuickJSHandle`](../exports.md#quickjshandle)[] +##### Returns + +`ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +##### Inherited from + +[`quickjs-emscripten.QuickJSContext.callFunction`](QuickJSContext.md#callfunction) + +##### Source + +[packages/quickjs-emscripten-core/src/context.ts:1065](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1065) + +*** + +### callMethod() + +> **callMethod**(`thisHandle`, `key`, `args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +`handle[key](...args)` + +Call a method on a JSValue. This is a convenience method that calls [getProp](QuickJSAsyncContext.md#getprop) and [callFunction](QuickJSAsyncContext.md#callfunction). + +#### Parameters + +• **thisHandle**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **key**: [`QuickJSPropertyKey`](../exports.md#quickjspropertykey) + +• **args**: [`QuickJSHandle`](../exports.md#quickjshandle)[]= `[]` + #### Returns `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> @@ -281,11 +352,11 @@ value. #### Inherited from -[`quickjs-emscripten.QuickJSContext.callFunction`](QuickJSContext.md#callfunction) +[`quickjs-emscripten.QuickJSContext.callMethod`](QuickJSContext.md#callmethod) #### Source -[packages/quickjs-emscripten-core/src/context.ts:1009](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1009) +[packages/quickjs-emscripten-core/src/context.ts:1114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1114) *** @@ -318,7 +389,7 @@ socket.on("data", chunk => { #### Source -[packages/quickjs-emscripten-core/src/context.ts:1335](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1335) +[packages/quickjs-emscripten-core/src/context.ts:1423](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1423) *** @@ -349,7 +420,7 @@ Javascript string or number (which will be converted automatically to a JSValue) #### Source -[packages/quickjs-emscripten-core/src/context.ts:960](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L960) +[packages/quickjs-emscripten-core/src/context.ts:1001](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1001) *** @@ -374,7 +445,7 @@ will result in an error. #### Source -[packages/quickjs-emscripten-core/src/context.ts:261](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L261) +[packages/quickjs-emscripten-core/src/context.ts:266](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L266) *** @@ -400,7 +471,7 @@ Returns `handle.toString()` if it cannot be serialized to JSON. #### Source -[packages/quickjs-emscripten-core/src/context.ts:1147](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1147) +[packages/quickjs-emscripten-core/src/context.ts:1235](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1235) *** @@ -434,7 +505,7 @@ socket.write(dataLifetime?.value) #### Source -[packages/quickjs-emscripten-core/src/context.ts:1318](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1318) +[packages/quickjs-emscripten-core/src/context.ts:1406](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1406) *** @@ -461,7 +532,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:807](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L807) +[packages/quickjs-emscripten-core/src/context.ts:812](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L812) *** @@ -524,7 +595,7 @@ interrupted, the error will have name `InternalError` and message #### Source -[packages/quickjs-emscripten-core/src/context.ts:1069](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1069) +[packages/quickjs-emscripten-core/src/context.ts:1157](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1157) *** @@ -550,7 +621,7 @@ See [EvalFlags](../exports.md#evalflags) for number semantics #### Source -[packages/quickjs-emscripten-core/src/context-asyncify.ts:45](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L45) +[packages/quickjs-emscripten-core/src/context-asyncify.ts:44](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L44) *** @@ -572,7 +643,7 @@ See [EvalFlags](../exports.md#evalflags) for number semantics #### Source -[packages/quickjs-emscripten-core/src/context.ts:1344](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1344) +[packages/quickjs-emscripten-core/src/context.ts:1432](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1432) *** @@ -596,7 +667,7 @@ Coverts `handle` to a JavaScript ArrayBuffer #### Source -[packages/quickjs-emscripten-core/src/context.ts:686](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L686) +[packages/quickjs-emscripten-core/src/context.ts:691](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L691) *** @@ -620,13 +691,13 @@ Converts `handle` to a Javascript bigint. #### Source -[packages/quickjs-emscripten-core/src/context.ts:677](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L677) +[packages/quickjs-emscripten-core/src/context.ts:682](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L682) *** ### getIterator() -> **getIterator**(`handle`): `ContextResult`\<`QuickJSIterator`\> +> **getIterator**(`iterableHandle`): `ContextResult`\<`QuickJSIterator`\> `handle[Symbol.iterator]()`. See [QuickJSIterator]([object Object]). Returns a host iterator that wraps and proxies calls to a guest iterator handle. @@ -635,20 +706,16 @@ Once the iterator is done, the handle is automatically disposed, and the iterato is considered done if the handle is disposed. ```typescript -for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) { - const nextHandle = context.unwrapResult(nextResult) - try { - // Do something with nextHandle - console.log(context.dump(nextHandle)) - } finally { - nextHandle.dispose() - } +for (using entriesHandle of context.getIterator(mapHandle).unwrap()) { + using keyHandle = context.getProp(entriesHandle, 0) + using valueHandle = context.getProp(entriesHandle, 1) + console.log(context.dump(keyHandle), '->', context.dump(valueHandle)) } ``` #### Parameters -• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) +• **iterableHandle**: [`QuickJSHandle`](../exports.md#quickjshandle) #### Returns @@ -660,7 +727,7 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) #### Source -[packages/quickjs-emscripten-core/src/context.ts:920](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L920) +[packages/quickjs-emscripten-core/src/context.ts:961](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L961) *** @@ -668,7 +735,16 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) > **getLength**(`handle`): `undefined` \| `number` -`handle.length`. +`handle.length` as a host number. + +Example use: +```typescript +const length = context.getLength(arrayHandle) ?? 0 +for (let i = 0; i < length; i++) { + using value = context.getProp(arrayHandle, i) + console.log(`array[${i}] =`, context.dump(value)) +} +``` #### Parameters @@ -678,13 +754,15 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) `undefined` \| `number` +a number if the handle has a numeric length property, otherwise `undefined`. + #### Inherited from [`quickjs-emscripten.QuickJSContext.getLength`](QuickJSContext.md#getlength) #### Source -[packages/quickjs-emscripten-core/src/context.ts:855](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L855) +[packages/quickjs-emscripten-core/src/context.ts:871](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L871) *** @@ -710,7 +788,61 @@ Converts `handle` into a Javascript number. #### Source -[packages/quickjs-emscripten-core/src/context.ts:648](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L648) +[packages/quickjs-emscripten-core/src/context.ts:653](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L653) + +*** + +### getOwnPropertyNames() + +> **getOwnPropertyNames**(`handle`, `options`): `ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`QuickJSHandle`](../exports.md#quickjshandle)\>\> + +`Object.getOwnPropertyNames(handle)`. +Similar to the [standard semantics](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames), +but with extra, non-standard options for: + +- fetching array indexes as numbers (`numbers: true`) +- including symbols (`symbols: true`) +- only iterating over enumerable properties (`onlyEnumerable: true`) + +The default behavior is to emulate the standard: +```typescript +context.getOwnPropertyNames(handle, { strings: true, numbersAsStrings: true }) +``` + +Note when passing an explicit options object, you must set at least one +option, and `strings` are not included unless specified. + +Example use: +```typescript +for (using prop of context.getOwnPropertyNames(objectHandle).unwrap()) { + using value = context.getProp(handle, prop) + console.log(context.dump(prop), '->', context.dump(value)) +} +``` + +#### Parameters + +• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **options**: `GetOwnPropertyNamesOptions`= `undefined` + +#### Returns + +`ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`QuickJSHandle`](../exports.md#quickjshandle)\>\> + +an an array of handles of the property names. The array itself is disposable for your convenience. + +#### Inherited from + +[`quickjs-emscripten.QuickJSContext.getOwnPropertyNames`](QuickJSContext.md#getownpropertynames) + +#### Throws + +QuickJSEmptyGetOwnPropertyNames if no options are set. + +#### Source + +[packages/quickjs-emscripten-core/src/context.ts:908](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L908) *** @@ -744,7 +876,7 @@ resultHandle.dispose(); #### Source -[packages/quickjs-emscripten-core/src/context.ts:711](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L711) +[packages/quickjs-emscripten-core/src/context.ts:716](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L716) *** @@ -774,34 +906,7 @@ Javascript string (which will be converted automatically). #### Source -[packages/quickjs-emscripten-core/src/context.ts:836](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L836) - -*** - -### getPropNames() - -> **getPropNames**(`handle`, `options`): `ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`JSValue`](../exports.md#jsvalue)\>\> - -`Object.getOwnPropertyNames(handle)`. -Similar to the [standard semantics](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames). - -#### Parameters - -• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) - -• **options**: `GetOwnPropertyNamesOptions` - -#### Returns - -`ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`JSValue`](../exports.md#jsvalue)\>\> - -#### Inherited from - -[`quickjs-emscripten.QuickJSContext.getPropNames`](QuickJSContext.md#getpropnames) - -#### Source - -[packages/quickjs-emscripten-core/src/context.ts:868](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L868) +[packages/quickjs-emscripten-core/src/context.ts:841](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L841) *** @@ -825,7 +930,7 @@ Converts `handle` to a Javascript string. #### Source -[packages/quickjs-emscripten-core/src/context.ts:656](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L656) +[packages/quickjs-emscripten-core/src/context.ts:661](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L661) *** @@ -850,7 +955,7 @@ registry in the guest, it will be created with Symbol.for on the host. #### Source -[packages/quickjs-emscripten-core/src/context.ts:665](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L665) +[packages/quickjs-emscripten-core/src/context.ts:670](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L670) *** @@ -874,7 +979,7 @@ Access a well-known symbol that is a property of the global Symbol object, like #### Source -[packages/quickjs-emscripten-core/src/context.ts:384](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L384) +[packages/quickjs-emscripten-core/src/context.ts:389](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L389) *** @@ -895,7 +1000,7 @@ Create a new QuickJS [array](https://developer.mozilla.org/en-US/docs/Web/JavaSc #### Source -[packages/quickjs-emscripten-core/src/context.ts:426](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L426) +[packages/quickjs-emscripten-core/src/context.ts:431](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L431) *** @@ -919,7 +1024,7 @@ Create a new QuickJS [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/ #### Source -[packages/quickjs-emscripten-core/src/context.ts:434](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L434) +[packages/quickjs-emscripten-core/src/context.ts:439](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L439) *** @@ -951,7 +1056,7 @@ See [Emscripten's docs on Asyncify](https://emscripten.org/docs/porting/asyncify #### Source -[packages/quickjs-emscripten-core/src/context-asyncify.ts:92](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L92) +[packages/quickjs-emscripten-core/src/context-asyncify.ts:91](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L91) *** @@ -975,7 +1080,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip #### Source -[packages/quickjs-emscripten-core/src/context.ts:392](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L392) +[packages/quickjs-emscripten-core/src/context.ts:397](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L397) *** @@ -1003,7 +1108,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:603](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L603) +[packages/quickjs-emscripten-core/src/context.ts:608](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L608) #### newError(message) @@ -1023,7 +1128,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:604](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L604) +[packages/quickjs-emscripten-core/src/context.ts:609](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L609) #### newError(undefined) @@ -1039,7 +1144,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:605](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L605) +[packages/quickjs-emscripten-core/src/context.ts:610](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L610) *** @@ -1156,7 +1261,7 @@ return deferred.handle #### Source -[packages/quickjs-emscripten-core/src/context.ts:597](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L597) +[packages/quickjs-emscripten-core/src/context.ts:602](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L602) *** @@ -1180,7 +1285,7 @@ Converts a Javascript number into a QuickJS value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:343](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L343) +[packages/quickjs-emscripten-core/src/context.ts:348](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L348) *** @@ -1207,7 +1312,7 @@ Like [`Object.create`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/R #### Source -[packages/quickjs-emscripten-core/src/context.ts:412](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L412) +[packages/quickjs-emscripten-core/src/context.ts:417](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L417) *** @@ -1232,7 +1337,7 @@ resources; see the documentation on [QuickJSDeferredPromise](QuickJSDeferredProm ##### Source -[packages/quickjs-emscripten-core/src/context.ts:447](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L447) +[packages/quickjs-emscripten-core/src/context.ts:452](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L452) #### newPromise(promise) @@ -1258,7 +1363,7 @@ You can still resolve/reject the created promise "early" using its methods. ##### Source -[packages/quickjs-emscripten-core/src/context.ts:455](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L455) +[packages/quickjs-emscripten-core/src/context.ts:460](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L460) #### newPromise(newPromiseFn) @@ -1283,7 +1388,7 @@ You can still resolve/reject the created promise "early" using its methods. ##### Source -[packages/quickjs-emscripten-core/src/context.ts:462](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L462) +[packages/quickjs-emscripten-core/src/context.ts:467](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L467) *** @@ -1307,7 +1412,7 @@ Create a QuickJS [string](https://developer.mozilla.org/en-US/docs/Web/JavaScrip #### Source -[packages/quickjs-emscripten-core/src/context.ts:350](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L350) +[packages/quickjs-emscripten-core/src/context.ts:355](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L355) *** @@ -1332,7 +1437,7 @@ All symbols created with the same key will be the same value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:373](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L373) +[packages/quickjs-emscripten-core/src/context.ts:378](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L378) *** @@ -1357,7 +1462,7 @@ No two symbols created with this function will be the same value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:361](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L361) +[packages/quickjs-emscripten-core/src/context.ts:366](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L366) *** @@ -1389,7 +1494,7 @@ You may need to call [runtime](QuickJSAsyncContext.md#runtime).[QuickJSRuntime#e #### Source -[packages/quickjs-emscripten-core/src/context.ts:750](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L750) +[packages/quickjs-emscripten-core/src/context.ts:755](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L755) *** @@ -1416,7 +1521,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:815](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L815) +[packages/quickjs-emscripten-core/src/context.ts:820](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L820) *** @@ -1443,7 +1548,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:823](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L823) +[packages/quickjs-emscripten-core/src/context.ts:828](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L828) *** @@ -1480,7 +1585,7 @@ properties. #### Source -[packages/quickjs-emscripten-core/src/context.ts:945](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L945) +[packages/quickjs-emscripten-core/src/context.ts:986](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L986) *** @@ -1506,7 +1611,7 @@ properties. #### Source -[packages/quickjs-emscripten-core/src/context.ts:1340](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1340) +[packages/quickjs-emscripten-core/src/context.ts:1428](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1428) *** @@ -1530,7 +1635,7 @@ Throw an error in the VM, interrupted whatever current execution is in progress #### Source -[packages/quickjs-emscripten-core/src/context.ts:1106](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1106) +[packages/quickjs-emscripten-core/src/context.ts:1194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1194) *** @@ -1558,7 +1663,7 @@ Does not support BigInt values correctly. #### Source -[packages/quickjs-emscripten-core/src/context.ts:639](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L639) +[packages/quickjs-emscripten-core/src/context.ts:644](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L644) *** @@ -1589,7 +1694,7 @@ If the result is an error, converts the error to a native object and throws the #### Source -[packages/quickjs-emscripten-core/src/context.ts:1190](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1190) +[packages/quickjs-emscripten-core/src/context.ts:1278](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1278) *** diff --git a/doc/quickjs-emscripten/classes/QuickJSAsyncRuntime.md b/doc/quickjs-emscripten/classes/QuickJSAsyncRuntime.md index 2d47537d..1167449a 100644 --- a/doc/quickjs-emscripten/classes/QuickJSAsyncRuntime.md +++ b/doc/quickjs-emscripten/classes/QuickJSAsyncRuntime.md @@ -41,13 +41,16 @@ Configure ES module loading with [setModuleLoader](QuickJSAsyncRuntime.md#setmod - [`[dispose]`()](QuickJSAsyncRuntime.md#dispose) - [assertOwned()](QuickJSAsyncRuntime.md#assertowned) - [computeMemoryUsage()](QuickJSAsyncRuntime.md#computememoryusage) + - [debugLog()](QuickJSAsyncRuntime.md#debuglog) - [dispose()](QuickJSAsyncRuntime.md#dispose) - [dumpMemoryUsage()](QuickJSAsyncRuntime.md#dumpmemoryusage) - [executePendingJobs()](QuickJSAsyncRuntime.md#executependingjobs) - [hasPendingJob()](QuickJSAsyncRuntime.md#haspendingjob) + - [isDebugMode()](QuickJSAsyncRuntime.md#isdebugmode) - [newContext()](QuickJSAsyncRuntime.md#newcontext) - [removeInterruptHandler()](QuickJSAsyncRuntime.md#removeinterrupthandler) - [removeModuleLoader()](QuickJSAsyncRuntime.md#removemoduleloader) + - [setDebugMode()](QuickJSAsyncRuntime.md#setdebugmode) - [setInterruptHandler()](QuickJSAsyncRuntime.md#setinterrupthandler) - [setMaxStackSize()](QuickJSAsyncRuntime.md#setmaxstacksize) - [setMemoryLimit()](QuickJSAsyncRuntime.md#setmemorylimit) @@ -93,7 +96,7 @@ false after the object has been [dispose](QuickJSAsyncRuntime.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:121](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L121) +[packages/quickjs-emscripten-core/src/runtime.ts:125](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L125) ## Methods @@ -141,7 +144,7 @@ QuickJSWrongOwner if owned by a different runtime. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:323](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L323) +[packages/quickjs-emscripten-core/src/runtime.ts:327](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L327) *** @@ -165,7 +168,34 @@ For a human-digestible representation, see [dumpMemoryUsage](QuickJSAsyncRuntime #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:292](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L292) +[packages/quickjs-emscripten-core/src/runtime.ts:296](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L296) + +*** + +### debugLog() + +> **debugLog**(...`msg`): `void` + +In debug mode, log the result of calling `msg()`. + +We take a function instead of a log message to avoid expensive string +manipulation if debug logging is disabled. + +#### Parameters + +• ...**msg**: `unknown`[] + +#### Returns + +`void` + +#### Inherited from + +[`quickjs-emscripten.QuickJSRuntime.debugLog`](QuickJSRuntime.md#debuglog) + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:363](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L363) *** @@ -185,7 +215,7 @@ Dispose of the underlying resources used by this object. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:125](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L125) +[packages/quickjs-emscripten-core/src/runtime.ts:129](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L129) *** @@ -206,7 +236,7 @@ For programmatic access to this information, see [computeMemoryUsage](QuickJSAsy #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:303](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L303) +[packages/quickjs-emscripten-core/src/runtime.ts:307](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L307) *** @@ -244,7 +274,7 @@ functions or rejected promises. Those errors are available by calling #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:239](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L239) +[packages/quickjs-emscripten-core/src/runtime.ts:243](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L243) *** @@ -267,7 +297,27 @@ true if there is at least one pendingJob queued up. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:190](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L190) +[packages/quickjs-emscripten-core/src/runtime.ts:194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L194) + +*** + +### isDebugMode() + +> **isDebugMode**(): `boolean` + +#### Returns + +`boolean` + +true if debug logging is enabled + +#### Inherited from + +[`quickjs-emscripten.QuickJSRuntime.isDebugMode`](QuickJSRuntime.md#isdebugmode) + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:353](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L353) *** @@ -316,7 +366,7 @@ See [setInterruptHandler](QuickJSAsyncRuntime.md#setinterrupthandler). #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:215](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L215) +[packages/quickjs-emscripten-core/src/runtime.ts:219](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L219) *** @@ -336,7 +386,34 @@ Remove the the loader set by [setModuleLoader](QuickJSAsyncRuntime.md#setmodulel #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:177](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L177) +[packages/quickjs-emscripten-core/src/runtime.ts:181](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L181) + +*** + +### setDebugMode() + +> **setDebugMode**(`enabled`): `void` + +Enable or disable debug logging. + +If this module is a DEBUG variant, more logs will be printed from the C +code. + +#### Parameters + +• **enabled**: `boolean` + +#### Returns + +`void` + +#### Inherited from + +[`quickjs-emscripten.QuickJSRuntime.setDebugMode`](QuickJSRuntime.md#setdebugmode) + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:343](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L343) *** @@ -364,7 +441,7 @@ The interrupt handler can be removed with [removeInterruptHandler](QuickJSAsyncR #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L203) +[packages/quickjs-emscripten-core/src/runtime.ts:207](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L207) *** @@ -417,7 +494,7 @@ To remove the limit, set to `-1`. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:277](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L277) +[packages/quickjs-emscripten-core/src/runtime.ts:281](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L281) *** diff --git a/doc/quickjs-emscripten/classes/QuickJSContext.md b/doc/quickjs-emscripten/classes/QuickJSContext.md index 32390f8b..2d35df5e 100644 --- a/doc/quickjs-emscripten/classes/QuickJSContext.md +++ b/doc/quickjs-emscripten/classes/QuickJSContext.md @@ -54,6 +54,7 @@ See [QuickJSRuntime](QuickJSRuntime.md) for more information. - [Methods](QuickJSContext.md#methods) - [`[dispose]`()](QuickJSContext.md#dispose) - [callFunction()](QuickJSContext.md#callfunction) + - [callMethod()](QuickJSContext.md#callmethod) - [decodeBinaryJSON()](QuickJSContext.md#decodebinaryjson) - [defineProp()](QuickJSContext.md#defineprop) - [dispose()](QuickJSContext.md#dispose) @@ -67,9 +68,9 @@ See [QuickJSRuntime](QuickJSRuntime.md) for more information. - [getIterator()](QuickJSContext.md#getiterator) - [getLength()](QuickJSContext.md#getlength) - [getNumber()](QuickJSContext.md#getnumber) + - [getOwnPropertyNames()](QuickJSContext.md#getownpropertynames) - [getPromiseState()](QuickJSContext.md#getpromisestate) - [getProp()](QuickJSContext.md#getprop) - - [getPropNames()](QuickJSContext.md#getpropnames) - [getString()](QuickJSContext.md#getstring) - [getSymbol()](QuickJSContext.md#getsymbol) - [getWellKnownSymbol()](QuickJSContext.md#getwellknownsymbol) @@ -139,7 +140,7 @@ to create a new QuickJSContext. #### Source -[packages/quickjs-emscripten-core/src/context.ts:220](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L220) +[packages/quickjs-emscripten-core/src/context.ts:225](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L225) ## Properties @@ -151,7 +152,7 @@ The runtime that created this context. #### Source -[packages/quickjs-emscripten-core/src/context.ts:182](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L182) +[packages/quickjs-emscripten-core/src/context.ts:187](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L187) ## Accessors @@ -169,7 +170,7 @@ false after the object has been [dispose](QuickJSContext.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/context.ts:251](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L251) +[packages/quickjs-emscripten-core/src/context.ts:256](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L256) *** @@ -185,7 +186,7 @@ false after the object has been [dispose](QuickJSContext.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/context.ts:309](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L309) +[packages/quickjs-emscripten-core/src/context.ts:314](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L314) *** @@ -203,7 +204,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:324](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L324) +[packages/quickjs-emscripten-core/src/context.ts:329](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L329) *** @@ -219,7 +220,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:283](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L283) +[packages/quickjs-emscripten-core/src/context.ts:288](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L288) *** @@ -235,7 +236,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:296](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L296) +[packages/quickjs-emscripten-core/src/context.ts:301](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L301) *** @@ -251,7 +252,7 @@ You can set properties to create global variables. #### Source -[packages/quickjs-emscripten-core/src/context.ts:270](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L270) +[packages/quickjs-emscripten-core/src/context.ts:275](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L275) ## Methods @@ -281,9 +282,12 @@ Just calls the standard .dispose() method of this class. ### callFunction() -> **callFunction**(`func`, `thisVal`, ...`args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> +#### callFunction(func, thisVal, args) + +> **callFunction**(`func`, `thisVal`, `args`?): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> -[`func.call(thisVal, ...args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). +[`func.call(thisVal, ...args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) or +[`func.apply(thisVal, args)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply). Call a JSValue as a function. See [unwrapResult](QuickJSContext.md#unwrapresult), which will throw if the function returned an error, or @@ -291,15 +295,15 @@ return the result handle directly. If evaluation returned a handle containing a promise, use [resolvePromise](QuickJSContext.md#resolvepromise) to convert it to a native promise and [runtime](QuickJSContext.md#runtime).[QuickJSRuntime#executePendingJobs](QuickJSRuntime.md#executependingjobs) to finish evaluating the promise. -#### Parameters +##### Parameters • **func**: [`QuickJSHandle`](../exports.md#quickjshandle) • **thisVal**: [`QuickJSHandle`](../exports.md#quickjshandle) -• ...**args**: [`QuickJSHandle`](../exports.md#quickjshandle)[] +• **args?**: [`QuickJSHandle`](../exports.md#quickjshandle)[] -#### Returns +##### Returns `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> @@ -307,13 +311,76 @@ A result. If the function threw synchronously, `result.error` be a handle to the exception. Otherwise `result.value` will be a handle to the value. -#### Implementation of +Example: + +```typescript +using parseIntHandle = context.getProp(global, "parseInt") +using stringHandle = context.newString("42") +using resultHandle = context.callFunction(parseIntHandle, context.undefined, stringHandle).unwrap() +console.log(context.dump(resultHandle)) // 42 +``` + +##### Implementation of [`quickjs-emscripten.LowLevelJavascriptVm.callFunction`](../interfaces/LowLevelJavascriptVm.md#callfunction) +##### Source + +[packages/quickjs-emscripten-core/src/context.ts:1060](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1060) + +#### callFunction(func, thisVal, args) + +> **callFunction**(`func`, `thisVal`, ...`args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +##### Parameters + +• **func**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **thisVal**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• ...**args**: [`QuickJSHandle`](../exports.md#quickjshandle)[] + +##### Returns + +`ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +##### Implementation of + +`LowLevelJavascriptVm.callFunction` + +##### Source + +[packages/quickjs-emscripten-core/src/context.ts:1065](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1065) + +*** + +### callMethod() + +> **callMethod**(`thisHandle`, `key`, `args`): `ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +`handle[key](...args)` + +Call a method on a JSValue. This is a convenience method that calls [getProp](QuickJSContext.md#getprop) and [callFunction](QuickJSContext.md#callfunction). + +#### Parameters + +• **thisHandle**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **key**: [`QuickJSPropertyKey`](../exports.md#quickjspropertykey) + +• **args**: [`QuickJSHandle`](../exports.md#quickjshandle)[]= `[]` + +#### Returns + +`ContextResult`\<[`QuickJSHandle`](../exports.md#quickjshandle)\> + +A result. If the function threw synchronously, `result.error` be a +handle to the exception. Otherwise `result.value` will be a handle to the +value. + #### Source -[packages/quickjs-emscripten-core/src/context.ts:1009](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1009) +[packages/quickjs-emscripten-core/src/context.ts:1114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1114) *** @@ -342,7 +409,7 @@ socket.on("data", chunk => { #### Source -[packages/quickjs-emscripten-core/src/context.ts:1335](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1335) +[packages/quickjs-emscripten-core/src/context.ts:1423](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1423) *** @@ -373,7 +440,7 @@ Javascript string or number (which will be converted automatically to a JSValue) #### Source -[packages/quickjs-emscripten-core/src/context.ts:960](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L960) +[packages/quickjs-emscripten-core/src/context.ts:1001](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1001) *** @@ -402,7 +469,7 @@ will result in an error. #### Source -[packages/quickjs-emscripten-core/src/context.ts:261](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L261) +[packages/quickjs-emscripten-core/src/context.ts:266](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L266) *** @@ -424,7 +491,7 @@ Returns `handle.toString()` if it cannot be serialized to JSON. #### Source -[packages/quickjs-emscripten-core/src/context.ts:1147](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1147) +[packages/quickjs-emscripten-core/src/context.ts:1235](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1235) *** @@ -454,7 +521,7 @@ socket.write(dataLifetime?.value) #### Source -[packages/quickjs-emscripten-core/src/context.ts:1318](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1318) +[packages/quickjs-emscripten-core/src/context.ts:1406](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1406) *** @@ -477,7 +544,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:807](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L807) +[packages/quickjs-emscripten-core/src/context.ts:812](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L812) *** @@ -540,7 +607,7 @@ interrupted, the error will have name `InternalError` and message #### Source -[packages/quickjs-emscripten-core/src/context.ts:1069](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1069) +[packages/quickjs-emscripten-core/src/context.ts:1157](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1157) *** @@ -558,7 +625,7 @@ interrupted, the error will have name `InternalError` and message #### Source -[packages/quickjs-emscripten-core/src/context.ts:1344](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1344) +[packages/quickjs-emscripten-core/src/context.ts:1432](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1432) *** @@ -578,7 +645,7 @@ Coverts `handle` to a JavaScript ArrayBuffer #### Source -[packages/quickjs-emscripten-core/src/context.ts:686](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L686) +[packages/quickjs-emscripten-core/src/context.ts:691](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L691) *** @@ -598,13 +665,13 @@ Converts `handle` to a Javascript bigint. #### Source -[packages/quickjs-emscripten-core/src/context.ts:677](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L677) +[packages/quickjs-emscripten-core/src/context.ts:682](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L682) *** ### getIterator() -> **getIterator**(`handle`): `ContextResult`\<`QuickJSIterator`\> +> **getIterator**(`iterableHandle`): `ContextResult`\<`QuickJSIterator`\> `handle[Symbol.iterator]()`. See [QuickJSIterator]([object Object]). Returns a host iterator that wraps and proxies calls to a guest iterator handle. @@ -613,20 +680,16 @@ Once the iterator is done, the handle is automatically disposed, and the iterato is considered done if the handle is disposed. ```typescript -for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) { - const nextHandle = context.unwrapResult(nextResult) - try { - // Do something with nextHandle - console.log(context.dump(nextHandle)) - } finally { - nextHandle.dispose() - } +for (using entriesHandle of context.getIterator(mapHandle).unwrap()) { + using keyHandle = context.getProp(entriesHandle, 0) + using valueHandle = context.getProp(entriesHandle, 1) + console.log(context.dump(keyHandle), '->', context.dump(valueHandle)) } ``` #### Parameters -• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) +• **iterableHandle**: [`QuickJSHandle`](../exports.md#quickjshandle) #### Returns @@ -634,7 +697,7 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) #### Source -[packages/quickjs-emscripten-core/src/context.ts:920](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L920) +[packages/quickjs-emscripten-core/src/context.ts:961](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L961) *** @@ -642,7 +705,16 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) > **getLength**(`handle`): `undefined` \| `number` -`handle.length`. +`handle.length` as a host number. + +Example use: +```typescript +const length = context.getLength(arrayHandle) ?? 0 +for (let i = 0; i < length; i++) { + using value = context.getProp(arrayHandle, i) + console.log(`array[${i}] =`, context.dump(value)) +} +``` #### Parameters @@ -652,9 +724,11 @@ for (const nextResult of context.unwrapResult(context.getIterator(arrayHandle)) `undefined` \| `number` +a number if the handle has a numeric length property, otherwise `undefined`. + #### Source -[packages/quickjs-emscripten-core/src/context.ts:855](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L855) +[packages/quickjs-emscripten-core/src/context.ts:871](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L871) *** @@ -680,7 +754,57 @@ Converts `handle` into a Javascript number. #### Source -[packages/quickjs-emscripten-core/src/context.ts:648](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L648) +[packages/quickjs-emscripten-core/src/context.ts:653](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L653) + +*** + +### getOwnPropertyNames() + +> **getOwnPropertyNames**(`handle`, `options`): `ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`QuickJSHandle`](../exports.md#quickjshandle)\>\> + +`Object.getOwnPropertyNames(handle)`. +Similar to the [standard semantics](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames), +but with extra, non-standard options for: + +- fetching array indexes as numbers (`numbers: true`) +- including symbols (`symbols: true`) +- only iterating over enumerable properties (`onlyEnumerable: true`) + +The default behavior is to emulate the standard: +```typescript +context.getOwnPropertyNames(handle, { strings: true, numbersAsStrings: true }) +``` + +Note when passing an explicit options object, you must set at least one +option, and `strings` are not included unless specified. + +Example use: +```typescript +for (using prop of context.getOwnPropertyNames(objectHandle).unwrap()) { + using value = context.getProp(handle, prop) + console.log(context.dump(prop), '->', context.dump(value)) +} +``` + +#### Parameters + +• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) + +• **options**: `GetOwnPropertyNamesOptions`= `undefined` + +#### Returns + +`ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`QuickJSHandle`](../exports.md#quickjshandle)\>\> + +an an array of handles of the property names. The array itself is disposable for your convenience. + +#### Throws + +QuickJSEmptyGetOwnPropertyNames if no options are set. + +#### Source + +[packages/quickjs-emscripten-core/src/context.ts:908](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L908) *** @@ -710,7 +834,7 @@ resultHandle.dispose(); #### Source -[packages/quickjs-emscripten-core/src/context.ts:711](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L711) +[packages/quickjs-emscripten-core/src/context.ts:716](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L716) *** @@ -740,30 +864,7 @@ Javascript string (which will be converted automatically). #### Source -[packages/quickjs-emscripten-core/src/context.ts:836](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L836) - -*** - -### getPropNames() - -> **getPropNames**(`handle`, `options`): `ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`JSValue`](../exports.md#jsvalue)\>\> - -`Object.getOwnPropertyNames(handle)`. -Similar to the [standard semantics](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames). - -#### Parameters - -• **handle**: [`QuickJSHandle`](../exports.md#quickjshandle) - -• **options**: `GetOwnPropertyNamesOptions` - -#### Returns - -`ContextResult`\<[`DisposableArray`](../exports.md#disposablearrayt)\<[`JSValue`](../exports.md#jsvalue)\>\> - -#### Source - -[packages/quickjs-emscripten-core/src/context.ts:868](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L868) +[packages/quickjs-emscripten-core/src/context.ts:841](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L841) *** @@ -787,7 +888,7 @@ Converts `handle` to a Javascript string. #### Source -[packages/quickjs-emscripten-core/src/context.ts:656](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L656) +[packages/quickjs-emscripten-core/src/context.ts:661](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L661) *** @@ -808,7 +909,7 @@ registry in the guest, it will be created with Symbol.for on the host. #### Source -[packages/quickjs-emscripten-core/src/context.ts:665](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L665) +[packages/quickjs-emscripten-core/src/context.ts:670](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L670) *** @@ -828,7 +929,7 @@ Access a well-known symbol that is a property of the global Symbol object, like #### Source -[packages/quickjs-emscripten-core/src/context.ts:384](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L384) +[packages/quickjs-emscripten-core/src/context.ts:389](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L389) *** @@ -845,7 +946,7 @@ Create a new QuickJS [array](https://developer.mozilla.org/en-US/docs/Web/JavaSc #### Source -[packages/quickjs-emscripten-core/src/context.ts:426](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L426) +[packages/quickjs-emscripten-core/src/context.ts:431](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L431) *** @@ -865,7 +966,7 @@ Create a new QuickJS [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/ #### Source -[packages/quickjs-emscripten-core/src/context.ts:434](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L434) +[packages/quickjs-emscripten-core/src/context.ts:439](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L439) *** @@ -885,7 +986,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip #### Source -[packages/quickjs-emscripten-core/src/context.ts:392](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L392) +[packages/quickjs-emscripten-core/src/context.ts:397](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L397) *** @@ -909,7 +1010,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:603](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L603) +[packages/quickjs-emscripten-core/src/context.ts:608](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L608) #### newError(message) @@ -925,7 +1026,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:604](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L604) +[packages/quickjs-emscripten-core/src/context.ts:609](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L609) #### newError(undefined) @@ -937,7 +1038,7 @@ Create a QuickJS [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScrip ##### Source -[packages/quickjs-emscripten-core/src/context.ts:605](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L605) +[packages/quickjs-emscripten-core/src/context.ts:610](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L610) *** @@ -1054,7 +1155,7 @@ return deferred.handle #### Source -[packages/quickjs-emscripten-core/src/context.ts:597](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L597) +[packages/quickjs-emscripten-core/src/context.ts:602](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L602) *** @@ -1078,7 +1179,7 @@ Converts a Javascript number into a QuickJS value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:343](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L343) +[packages/quickjs-emscripten-core/src/context.ts:348](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L348) *** @@ -1105,7 +1206,7 @@ Like [`Object.create`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/R #### Source -[packages/quickjs-emscripten-core/src/context.ts:412](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L412) +[packages/quickjs-emscripten-core/src/context.ts:417](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L417) *** @@ -1126,7 +1227,7 @@ resources; see the documentation on [QuickJSDeferredPromise](QuickJSDeferredProm ##### Source -[packages/quickjs-emscripten-core/src/context.ts:447](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L447) +[packages/quickjs-emscripten-core/src/context.ts:452](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L452) #### newPromise(promise) @@ -1148,7 +1249,7 @@ You can still resolve/reject the created promise "early" using its methods. ##### Source -[packages/quickjs-emscripten-core/src/context.ts:455](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L455) +[packages/quickjs-emscripten-core/src/context.ts:460](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L460) #### newPromise(newPromiseFn) @@ -1169,7 +1270,7 @@ You can still resolve/reject the created promise "early" using its methods. ##### Source -[packages/quickjs-emscripten-core/src/context.ts:462](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L462) +[packages/quickjs-emscripten-core/src/context.ts:467](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L467) *** @@ -1193,7 +1294,7 @@ Create a QuickJS [string](https://developer.mozilla.org/en-US/docs/Web/JavaScrip #### Source -[packages/quickjs-emscripten-core/src/context.ts:350](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L350) +[packages/quickjs-emscripten-core/src/context.ts:355](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L355) *** @@ -1214,7 +1315,7 @@ All symbols created with the same key will be the same value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:373](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L373) +[packages/quickjs-emscripten-core/src/context.ts:378](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L378) *** @@ -1235,7 +1336,7 @@ No two symbols created with this function will be the same value. #### Source -[packages/quickjs-emscripten-core/src/context.ts:361](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L361) +[packages/quickjs-emscripten-core/src/context.ts:366](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L366) *** @@ -1263,7 +1364,7 @@ You may need to call [runtime](QuickJSContext.md#runtime).[QuickJSRuntime#execut #### Source -[packages/quickjs-emscripten-core/src/context.ts:750](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L750) +[packages/quickjs-emscripten-core/src/context.ts:755](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L755) *** @@ -1286,7 +1387,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:815](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L815) +[packages/quickjs-emscripten-core/src/context.ts:820](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L820) *** @@ -1309,7 +1410,7 @@ See [Equality comparisons and sameness](https://developer.mozilla.org/en-US/docs #### Source -[packages/quickjs-emscripten-core/src/context.ts:823](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L823) +[packages/quickjs-emscripten-core/src/context.ts:828](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L828) *** @@ -1346,7 +1447,7 @@ properties. #### Source -[packages/quickjs-emscripten-core/src/context.ts:945](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L945) +[packages/quickjs-emscripten-core/src/context.ts:986](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L986) *** @@ -1368,7 +1469,7 @@ properties. #### Source -[packages/quickjs-emscripten-core/src/context.ts:1340](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1340) +[packages/quickjs-emscripten-core/src/context.ts:1428](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1428) *** @@ -1388,7 +1489,7 @@ Throw an error in the VM, interrupted whatever current execution is in progress #### Source -[packages/quickjs-emscripten-core/src/context.ts:1106](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1106) +[packages/quickjs-emscripten-core/src/context.ts:1194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1194) *** @@ -1416,7 +1517,7 @@ Does not support BigInt values correctly. #### Source -[packages/quickjs-emscripten-core/src/context.ts:639](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L639) +[packages/quickjs-emscripten-core/src/context.ts:644](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L644) *** @@ -1443,7 +1544,7 @@ If the result is an error, converts the error to a native object and throws the #### Source -[packages/quickjs-emscripten-core/src/context.ts:1190](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1190) +[packages/quickjs-emscripten-core/src/context.ts:1278](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L1278) *** diff --git a/doc/quickjs-emscripten/classes/QuickJSRuntime.md b/doc/quickjs-emscripten/classes/QuickJSRuntime.md index 16c3cd29..a6c48a82 100644 --- a/doc/quickjs-emscripten/classes/QuickJSRuntime.md +++ b/doc/quickjs-emscripten/classes/QuickJSRuntime.md @@ -42,13 +42,16 @@ Configure ES module loading with [setModuleLoader](QuickJSRuntime.md#setmodulelo - [`[dispose]`()](QuickJSRuntime.md#dispose) - [assertOwned()](QuickJSRuntime.md#assertowned) - [computeMemoryUsage()](QuickJSRuntime.md#computememoryusage) + - [debugLog()](QuickJSRuntime.md#debuglog) - [dispose()](QuickJSRuntime.md#dispose) - [dumpMemoryUsage()](QuickJSRuntime.md#dumpmemoryusage) - [executePendingJobs()](QuickJSRuntime.md#executependingjobs) - [hasPendingJob()](QuickJSRuntime.md#haspendingjob) + - [isDebugMode()](QuickJSRuntime.md#isdebugmode) - [newContext()](QuickJSRuntime.md#newcontext) - [removeInterruptHandler()](QuickJSRuntime.md#removeinterrupthandler) - [removeModuleLoader()](QuickJSRuntime.md#removemoduleloader) + - [setDebugMode()](QuickJSRuntime.md#setdebugmode) - [setInterruptHandler()](QuickJSRuntime.md#setinterrupthandler) - [setMaxStackSize()](QuickJSRuntime.md#setmaxstacksize) - [setMemoryLimit()](QuickJSRuntime.md#setmemorylimit) @@ -94,7 +97,7 @@ false after the object has been [dispose](QuickJSRuntime.md#dispose-1)d #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:121](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L121) +[packages/quickjs-emscripten-core/src/runtime.ts:125](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L125) ## Methods @@ -142,7 +145,7 @@ QuickJSWrongOwner if owned by a different runtime. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:323](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L323) +[packages/quickjs-emscripten-core/src/runtime.ts:327](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L327) *** @@ -162,7 +165,30 @@ For a human-digestible representation, see [dumpMemoryUsage](QuickJSRuntime.md#d #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:292](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L292) +[packages/quickjs-emscripten-core/src/runtime.ts:296](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L296) + +*** + +### debugLog() + +> **debugLog**(...`msg`): `void` + +In debug mode, log the result of calling `msg()`. + +We take a function instead of a log message to avoid expensive string +manipulation if debug logging is disabled. + +#### Parameters + +• ...**msg**: `unknown`[] + +#### Returns + +`void` + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:363](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L363) *** @@ -186,7 +212,7 @@ Dispose of the underlying resources used by this object. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:125](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L125) +[packages/quickjs-emscripten-core/src/runtime.ts:129](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L129) *** @@ -203,7 +229,7 @@ For programmatic access to this information, see [computeMemoryUsage](QuickJSRun #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:303](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L303) +[packages/quickjs-emscripten-core/src/runtime.ts:307](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L307) *** @@ -237,7 +263,7 @@ functions or rejected promises. Those errors are available by calling #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:239](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L239) +[packages/quickjs-emscripten-core/src/runtime.ts:243](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L243) *** @@ -256,7 +282,23 @@ true if there is at least one pendingJob queued up. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:190](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L190) +[packages/quickjs-emscripten-core/src/runtime.ts:194](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L194) + +*** + +### isDebugMode() + +> **isDebugMode**(): `boolean` + +#### Returns + +`boolean` + +true if debug logging is enabled + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:353](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L353) *** @@ -280,7 +322,7 @@ You should dispose a created context before disposing this runtime. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:136](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L136) +[packages/quickjs-emscripten-core/src/runtime.ts:140](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L140) *** @@ -297,7 +339,7 @@ See [setInterruptHandler](QuickJSRuntime.md#setinterrupthandler). #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:215](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L215) +[packages/quickjs-emscripten-core/src/runtime.ts:219](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L219) *** @@ -313,7 +355,30 @@ Remove the the loader set by [setModuleLoader](QuickJSRuntime.md#setmoduleloader #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:177](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L177) +[packages/quickjs-emscripten-core/src/runtime.ts:181](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L181) + +*** + +### setDebugMode() + +> **setDebugMode**(`enabled`): `void` + +Enable or disable debug logging. + +If this module is a DEBUG variant, more logs will be printed from the C +code. + +#### Parameters + +• **enabled**: `boolean` + +#### Returns + +`void` + +#### Source + +[packages/quickjs-emscripten-core/src/runtime.ts:343](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L343) *** @@ -337,7 +402,7 @@ The interrupt handler can be removed with [removeInterruptHandler](QuickJSRuntim #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:203](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L203) +[packages/quickjs-emscripten-core/src/runtime.ts:207](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L207) *** @@ -358,7 +423,7 @@ To remove the limit, set to `0`. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:311](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L311) +[packages/quickjs-emscripten-core/src/runtime.ts:315](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L315) *** @@ -379,7 +444,7 @@ To remove the limit, set to `-1`. #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:277](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L277) +[packages/quickjs-emscripten-core/src/runtime.ts:281](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L281) *** @@ -404,7 +469,7 @@ The loader can be removed with [removeModuleLoader](QuickJSRuntime.md#removemodu #### Source -[packages/quickjs-emscripten-core/src/runtime.ts:168](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L168) +[packages/quickjs-emscripten-core/src/runtime.ts:172](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/runtime.ts#L172) *** diff --git a/doc/quickjs-emscripten/exports.md b/doc/quickjs-emscripten/exports.md index 1d4d2563..211cc711 100644 --- a/doc/quickjs-emscripten/exports.md +++ b/doc/quickjs-emscripten/exports.md @@ -88,6 +88,7 @@ - [newQuickJSWASMModule()](exports.md#newquickjswasmmodule) - [newQuickJSWASMModuleFromVariant()](exports.md#newquickjswasmmodulefromvariant) - [newVariant()](exports.md#newvariant) + - [setDebugMode()](exports.md#setdebugmode) - [shouldInterruptAfterDeadline()](exports.md#shouldinterruptafterdeadline) ## Namespaces @@ -160,7 +161,7 @@ #### Source -[packages/quickjs-emscripten-core/src/context-asyncify.ts:19](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L19) +[packages/quickjs-emscripten-core/src/context-asyncify.ts:18](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context-asyncify.ts#L18) *** @@ -218,7 +219,7 @@ An `Array` that also implements [Disposable](interfaces/Disposable.md): #### Source -packages/quickjs-ffi-types/dist/index.d.ts:534 +packages/quickjs-ffi-types/dist/index.d.ts:538 *** @@ -351,7 +352,7 @@ Language features that can be enabled or disabled in a QuickJSContext. #### Source -[packages/quickjs-emscripten-core/src/types.ts:145](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L145) +[packages/quickjs-emscripten-core/src/types.ts:146](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L146) *** @@ -410,7 +411,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:28 #### Source -[packages/quickjs-emscripten-core/src/types.ts:68](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L68) +[packages/quickjs-emscripten-core/src/types.ts:69](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L69) *** @@ -420,7 +421,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:28 #### Source -[packages/quickjs-emscripten-core/src/types.ts:69](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L69) +[packages/quickjs-emscripten-core/src/types.ts:70](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L70) *** @@ -430,7 +431,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:28 #### Source -[packages/quickjs-emscripten-core/src/types.ts:67](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L67) +[packages/quickjs-emscripten-core/src/types.ts:68](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L68) *** @@ -440,7 +441,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:28 #### Source -[packages/quickjs-emscripten-core/src/types.ts:86](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L86) +[packages/quickjs-emscripten-core/src/types.ts:87](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L87) *** @@ -450,7 +451,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:28 #### Source -[packages/quickjs-emscripten-core/src/types.ts:87](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L87) +[packages/quickjs-emscripten-core/src/types.ts:88](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L88) *** @@ -460,7 +461,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:28 #### Source -[packages/quickjs-emscripten-core/src/types.ts:85](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L85) +[packages/quickjs-emscripten-core/src/types.ts:86](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L86) *** @@ -667,7 +668,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:75 #### Source -[packages/quickjs-emscripten-core/src/types.ts:332](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L332) +[packages/quickjs-emscripten-core/src/types.ts:333](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L333) *** @@ -733,7 +734,7 @@ You must dispose of any handles you create by calling the `.dispose()` method. #### Source -[packages/quickjs-emscripten-core/src/types.ts:52](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L52) +[packages/quickjs-emscripten-core/src/types.ts:53](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L53) *** @@ -746,7 +747,7 @@ Property key for getting or setting a property on a handle with #### Source -[packages/quickjs-emscripten-core/src/context.ts:64](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L64) +[packages/quickjs-emscripten-core/src/context.ts:69](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/context.ts#L69) *** @@ -756,7 +757,7 @@ Property key for getting or setting a property on a handle with #### Source -packages/quickjs-ffi-types/dist/index.d.ts:533 +packages/quickjs-ffi-types/dist/index.d.ts:537 *** @@ -954,7 +955,7 @@ The default [Intrinsics](exports.md#intrinsics) language features enabled in a Q #### Source -[packages/quickjs-emscripten-core/src/types.ts:172](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L172) +[packages/quickjs-emscripten-core/src/types.ts:173](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L173) *** @@ -1654,6 +1655,29 @@ This may be necessary in Cloudflare Workers, which can't compile WebAssembly mod *** +### setDebugMode() + +> **setDebugMode**(`enabled`): `void` + +Enable (or disable) debug logging and object creation tracking globally. +This setting is inherited by newly created QuickJSRuntime instances. +To get debug logging in the WebAssembly module, you need to use a debug build variant. +See [the quickjs-emscripten-core README](https://github.com/justjake/quickjs-emscripten/tree/main/doc/quickjs-emscripten-core) for more about build variants. + +#### Parameters + +• **enabled**: `boolean`= `true` + +#### Returns + +`void` + +#### Source + +[packages/quickjs-emscripten-core/src/debug.ts:13](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/debug.ts#L13) + +*** + ### shouldInterruptAfterDeadline() > **shouldInterruptAfterDeadline**(`deadline`): [`InterruptHandler`](exports.md#interrupthandler) diff --git a/doc/quickjs-emscripten/interfaces/AsyncRuntimeOptions.md b/doc/quickjs-emscripten/interfaces/AsyncRuntimeOptions.md index 3d5166ad..b070271a 100644 --- a/doc/quickjs-emscripten/interfaces/AsyncRuntimeOptions.md +++ b/doc/quickjs-emscripten/interfaces/AsyncRuntimeOptions.md @@ -35,7 +35,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) +[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) *** @@ -49,7 +49,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:112](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L112) +[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) *** @@ -63,7 +63,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) +[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) *** @@ -77,7 +77,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) +[packages/quickjs-emscripten-core/src/types.ts:115](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L115) *** @@ -87,7 +87,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:136](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L136) +[packages/quickjs-emscripten-core/src/types.ts:137](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L137) *** @@ -101,7 +101,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:116](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L116) +[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) *** @@ -115,7 +115,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) +[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) *** @@ -129,7 +129,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) +[packages/quickjs-emscripten-core/src/types.ts:120](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L120) *** diff --git a/doc/quickjs-emscripten/interfaces/ContextEvalOptions.md b/doc/quickjs-emscripten/interfaces/ContextEvalOptions.md index 7acf967f..af30ce71 100644 --- a/doc/quickjs-emscripten/interfaces/ContextEvalOptions.md +++ b/doc/quickjs-emscripten/interfaces/ContextEvalOptions.md @@ -25,7 +25,7 @@ don't include the stack frames before this eval in the Error() backtraces #### Source -[packages/quickjs-emscripten-core/src/types.ts:262](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L262) +[packages/quickjs-emscripten-core/src/types.ts:263](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L263) *** @@ -39,7 +39,7 @@ with JS_EvalFunction(). #### Source -[packages/quickjs-emscripten-core/src/types.ts:260](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L260) +[packages/quickjs-emscripten-core/src/types.ts:261](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L261) *** @@ -51,7 +51,7 @@ Force "strict" mode #### Source -[packages/quickjs-emscripten-core/src/types.ts:252](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L252) +[packages/quickjs-emscripten-core/src/types.ts:253](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L253) *** @@ -63,7 +63,7 @@ Force "strip" mode #### Source -[packages/quickjs-emscripten-core/src/types.ts:254](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L254) +[packages/quickjs-emscripten-core/src/types.ts:255](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L255) *** @@ -78,7 +78,7 @@ Global code (default), or "module" code? #### Source -[packages/quickjs-emscripten-core/src/types.ts:250](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L250) +[packages/quickjs-emscripten-core/src/types.ts:251](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L251) *** diff --git a/doc/quickjs-emscripten/interfaces/ContextOptions.md b/doc/quickjs-emscripten/interfaces/ContextOptions.md index d1404c91..6b005b9f 100644 --- a/doc/quickjs-emscripten/interfaces/ContextOptions.md +++ b/doc/quickjs-emscripten/interfaces/ContextOptions.md @@ -37,7 +37,7 @@ const contextWithoutDateOrEval = runtime.newContext({ #### Source -[packages/quickjs-emscripten-core/src/types.ts:228](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L228) +[packages/quickjs-emscripten-core/src/types.ts:229](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L229) *** diff --git a/doc/quickjs-emscripten/interfaces/JSModuleLoader.md b/doc/quickjs-emscripten/interfaces/JSModuleLoader.md index 6967295f..080c0be9 100644 --- a/doc/quickjs-emscripten/interfaces/JSModuleLoader.md +++ b/doc/quickjs-emscripten/interfaces/JSModuleLoader.md @@ -22,7 +22,7 @@ Load module (sync) ## Source -[packages/quickjs-emscripten-core/src/types.ts:82](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L82) +[packages/quickjs-emscripten-core/src/types.ts:83](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L83) *** diff --git a/doc/quickjs-emscripten/interfaces/JSModuleLoaderAsync.md b/doc/quickjs-emscripten/interfaces/JSModuleLoaderAsync.md index 3226ea0f..fc9b7b85 100644 --- a/doc/quickjs-emscripten/interfaces/JSModuleLoaderAsync.md +++ b/doc/quickjs-emscripten/interfaces/JSModuleLoaderAsync.md @@ -22,7 +22,7 @@ Load module (async) ## Source -[packages/quickjs-emscripten-core/src/types.ts:75](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L75) +[packages/quickjs-emscripten-core/src/types.ts:76](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L76) *** diff --git a/doc/quickjs-emscripten/interfaces/JSModuleNormalizer.md b/doc/quickjs-emscripten/interfaces/JSModuleNormalizer.md index ea8ba5e7..c7b69275 100644 --- a/doc/quickjs-emscripten/interfaces/JSModuleNormalizer.md +++ b/doc/quickjs-emscripten/interfaces/JSModuleNormalizer.md @@ -26,7 +26,7 @@ ## Source -[packages/quickjs-emscripten-core/src/types.ts:99](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L99) +[packages/quickjs-emscripten-core/src/types.ts:100](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L100) > **JSModuleNormalizer**(`baseModuleName`, `requestedName`, `vm`): [`JSModuleNormalizeResult`](../exports.md#jsmodulenormalizeresult) \| `Promise`\<[`JSModuleNormalizeResult`](../exports.md#jsmodulenormalizeresult)\> @@ -44,7 +44,7 @@ ## Source -[packages/quickjs-emscripten-core/src/types.ts:92](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L92) +[packages/quickjs-emscripten-core/src/types.ts:93](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L93) *** diff --git a/doc/quickjs-emscripten/interfaces/JSModuleNormalizerAsync.md b/doc/quickjs-emscripten/interfaces/JSModuleNormalizerAsync.md index bbb79216..6a9d505b 100644 --- a/doc/quickjs-emscripten/interfaces/JSModuleNormalizerAsync.md +++ b/doc/quickjs-emscripten/interfaces/JSModuleNormalizerAsync.md @@ -26,7 +26,7 @@ ## Source -[packages/quickjs-emscripten-core/src/types.ts:92](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L92) +[packages/quickjs-emscripten-core/src/types.ts:93](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L93) *** diff --git a/doc/quickjs-emscripten/interfaces/QuickJSAsyncFFI.md b/doc/quickjs-emscripten/interfaces/QuickJSAsyncFFI.md index cc06871a..0d45618c 100644 --- a/doc/quickjs-emscripten/interfaces/QuickJSAsyncFFI.md +++ b/doc/quickjs-emscripten/interfaces/QuickJSAsyncFFI.md @@ -37,6 +37,7 @@ library. - [QTS\_FreeVoidPointer](QuickJSAsyncFFI.md#qts-freevoidpointer) - [QTS\_GetArrayBuffer](QuickJSAsyncFFI.md#qts-getarraybuffer) - [QTS\_GetArrayBufferLength](QuickJSAsyncFFI.md#qts-getarraybufferlength) + - [QTS\_GetDebugLogEnabled](QuickJSAsyncFFI.md#qts-getdebuglogenabled) - [QTS\_GetFalse](QuickJSAsyncFFI.md#qts-getfalse) - [QTS\_GetFloat64](QuickJSAsyncFFI.md#qts-getfloat64) - [QTS\_GetGlobalObject](QuickJSAsyncFFI.md#qts-getglobalobject) @@ -81,6 +82,7 @@ library. - [QTS\_RuntimeEnableModuleLoader](QuickJSAsyncFFI.md#qts-runtimeenablemoduleloader) - [QTS\_RuntimeSetMaxStackSize](QuickJSAsyncFFI.md#qts-runtimesetmaxstacksize) - [QTS\_RuntimeSetMemoryLimit](QuickJSAsyncFFI.md#qts-runtimesetmemorylimit) + - [QTS\_SetDebugLogEnabled](QuickJSAsyncFFI.md#qts-setdebuglogenabled) - [QTS\_SetProp](QuickJSAsyncFFI.md#qts-setprop) - [QTS\_SetProp\_MaybeAsync](QuickJSAsyncFFI.md#qts-setprop-maybeasync) - [QTS\_TestStringArg](QuickJSAsyncFFI.md#qts-teststringarg) @@ -103,7 +105,7 @@ Set at compile time. #### Source -packages/quickjs-ffi-types/dist/index.d.ts:422 +packages/quickjs-ffi-types/dist/index.d.ts:424 *** @@ -123,7 +125,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:422 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:489 +packages/quickjs-ffi-types/dist/index.d.ts:493 *** @@ -137,7 +139,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:489 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:487 +packages/quickjs-ffi-types/dist/index.d.ts:491 *** @@ -151,7 +153,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:487 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:486 +packages/quickjs-ffi-types/dist/index.d.ts:490 *** @@ -165,7 +167,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:486 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:429 +packages/quickjs-ffi-types/dist/index.d.ts:431 *** @@ -191,7 +193,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:429 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:470 +packages/quickjs-ffi-types/dist/index.d.ts:472 *** @@ -217,7 +219,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:470 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:471 +packages/quickjs-ffi-types/dist/index.d.ts:473 *** @@ -251,7 +253,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:471 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:467 +packages/quickjs-ffi-types/dist/index.d.ts:469 *** @@ -271,7 +273,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:467 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:473 +packages/quickjs-ffi-types/dist/index.d.ts:475 *** @@ -291,7 +293,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:473 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:474 +packages/quickjs-ffi-types/dist/index.d.ts:476 *** @@ -311,7 +313,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:474 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:443 +packages/quickjs-ffi-types/dist/index.d.ts:445 *** @@ -339,7 +341,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:443 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:475 +packages/quickjs-ffi-types/dist/index.d.ts:477 *** @@ -367,7 +369,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:475 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:476 +packages/quickjs-ffi-types/dist/index.d.ts:478 *** @@ -389,7 +391,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:476 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:459 +packages/quickjs-ffi-types/dist/index.d.ts:461 *** @@ -411,7 +413,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:459 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:460 +packages/quickjs-ffi-types/dist/index.d.ts:462 *** @@ -431,7 +433,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:460 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:442 +packages/quickjs-ffi-types/dist/index.d.ts:444 *** @@ -449,7 +451,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:442 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:438 +packages/quickjs-ffi-types/dist/index.d.ts:440 *** @@ -467,7 +469,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:438 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:436 +packages/quickjs-ffi-types/dist/index.d.ts:438 *** @@ -487,7 +489,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:436 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:439 +packages/quickjs-ffi-types/dist/index.d.ts:441 *** @@ -507,7 +509,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:439 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:440 +packages/quickjs-ffi-types/dist/index.d.ts:442 *** @@ -527,7 +529,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:440 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:441 +packages/quickjs-ffi-types/dist/index.d.ts:443 *** @@ -547,7 +549,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:441 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:452 +packages/quickjs-ffi-types/dist/index.d.ts:454 *** @@ -567,7 +569,25 @@ packages/quickjs-ffi-types/dist/index.d.ts:452 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:453 +packages/quickjs-ffi-types/dist/index.d.ts:455 + +*** + +### QTS\_GetDebugLogEnabled + +> **QTS\_GetDebugLogEnabled**: (`rt`) => `number` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +#### Returns + +`number` + +#### Source + +packages/quickjs-ffi-types/dist/index.d.ts:488 *** @@ -581,7 +601,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:453 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:433 +packages/quickjs-ffi-types/dist/index.d.ts:435 *** @@ -601,7 +621,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:433 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:449 +packages/quickjs-ffi-types/dist/index.d.ts:451 *** @@ -619,7 +639,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:449 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:481 +packages/quickjs-ffi-types/dist/index.d.ts:483 *** @@ -641,7 +661,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:481 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:479 +packages/quickjs-ffi-types/dist/index.d.ts:481 *** @@ -661,7 +681,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:479 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:477 +packages/quickjs-ffi-types/dist/index.d.ts:479 *** @@ -675,7 +695,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:477 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:432 +packages/quickjs-ffi-types/dist/index.d.ts:434 *** @@ -701,7 +721,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:432 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:468 +packages/quickjs-ffi-types/dist/index.d.ts:470 *** @@ -727,7 +747,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:468 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:469 +packages/quickjs-ffi-types/dist/index.d.ts:471 *** @@ -749,7 +769,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:469 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:461 +packages/quickjs-ffi-types/dist/index.d.ts:463 *** @@ -771,7 +791,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:461 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:463 +packages/quickjs-ffi-types/dist/index.d.ts:465 *** @@ -793,7 +813,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:463 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:464 +packages/quickjs-ffi-types/dist/index.d.ts:466 *** @@ -815,7 +835,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:464 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:462 +packages/quickjs-ffi-types/dist/index.d.ts:464 *** @@ -835,7 +855,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:462 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:451 +packages/quickjs-ffi-types/dist/index.d.ts:453 *** @@ -855,7 +875,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:451 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:455 +packages/quickjs-ffi-types/dist/index.d.ts:457 *** @@ -875,7 +895,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:455 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:456 +packages/quickjs-ffi-types/dist/index.d.ts:458 *** @@ -889,7 +909,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:456 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:434 +packages/quickjs-ffi-types/dist/index.d.ts:436 *** @@ -903,7 +923,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:434 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:431 +packages/quickjs-ffi-types/dist/index.d.ts:433 *** @@ -927,7 +947,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:431 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:480 +packages/quickjs-ffi-types/dist/index.d.ts:482 *** @@ -947,7 +967,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:480 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:457 +packages/quickjs-ffi-types/dist/index.d.ts:459 *** @@ -965,7 +985,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:457 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:458 +packages/quickjs-ffi-types/dist/index.d.ts:460 *** @@ -983,7 +1003,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:458 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:446 +packages/quickjs-ffi-types/dist/index.d.ts:448 *** @@ -1005,7 +1025,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:446 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:447 +packages/quickjs-ffi-types/dist/index.d.ts:449 *** @@ -1025,7 +1045,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:447 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:437 +packages/quickjs-ffi-types/dist/index.d.ts:439 *** @@ -1043,7 +1063,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:437 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:424 +packages/quickjs-ffi-types/dist/index.d.ts:426 *** @@ -1063,7 +1083,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:424 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:448 +packages/quickjs-ffi-types/dist/index.d.ts:450 *** @@ -1085,7 +1105,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:448 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:488 +packages/quickjs-ffi-types/dist/index.d.ts:492 *** @@ -1103,7 +1123,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:488 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:444 +packages/quickjs-ffi-types/dist/index.d.ts:446 *** @@ -1123,7 +1143,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:444 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:445 +packages/quickjs-ffi-types/dist/index.d.ts:447 *** @@ -1143,7 +1163,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:445 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:482 +packages/quickjs-ffi-types/dist/index.d.ts:484 *** @@ -1157,7 +1177,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:482 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:435 +packages/quickjs-ffi-types/dist/index.d.ts:437 *** @@ -1177,7 +1197,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:435 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:450 +packages/quickjs-ffi-types/dist/index.d.ts:452 *** @@ -1199,7 +1219,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:450 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:454 +packages/quickjs-ffi-types/dist/index.d.ts:456 *** @@ -1219,7 +1239,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:454 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:484 +packages/quickjs-ffi-types/dist/index.d.ts:486 *** @@ -1239,7 +1259,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:484 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:483 +packages/quickjs-ffi-types/dist/index.d.ts:485 *** @@ -1253,7 +1273,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:483 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:428 +packages/quickjs-ffi-types/dist/index.d.ts:430 *** @@ -1273,7 +1293,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:428 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:472 +packages/quickjs-ffi-types/dist/index.d.ts:474 *** @@ -1293,7 +1313,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:472 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:426 +packages/quickjs-ffi-types/dist/index.d.ts:428 *** @@ -1311,7 +1331,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:426 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:491 +packages/quickjs-ffi-types/dist/index.d.ts:495 *** @@ -1329,7 +1349,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:491 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:493 +packages/quickjs-ffi-types/dist/index.d.ts:497 *** @@ -1347,7 +1367,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:493 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:427 +packages/quickjs-ffi-types/dist/index.d.ts:429 *** @@ -1365,7 +1385,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:427 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:490 +packages/quickjs-ffi-types/dist/index.d.ts:494 *** @@ -1385,7 +1405,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:490 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:492 +packages/quickjs-ffi-types/dist/index.d.ts:496 *** @@ -1405,7 +1425,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:492 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:430 +packages/quickjs-ffi-types/dist/index.d.ts:432 *** @@ -1425,7 +1445,27 @@ packages/quickjs-ffi-types/dist/index.d.ts:430 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:425 +packages/quickjs-ffi-types/dist/index.d.ts:427 + +*** + +### QTS\_SetDebugLogEnabled + +> **QTS\_SetDebugLogEnabled**: (`rt`, `is_enabled`) => `void` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +• **is\_enabled**: `number` + +#### Returns + +`void` + +#### Source + +packages/quickjs-ffi-types/dist/index.d.ts:489 *** @@ -1449,7 +1489,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:425 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:465 +packages/quickjs-ffi-types/dist/index.d.ts:467 *** @@ -1473,7 +1513,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:465 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:466 +packages/quickjs-ffi-types/dist/index.d.ts:468 *** @@ -1491,7 +1531,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:466 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:485 +packages/quickjs-ffi-types/dist/index.d.ts:487 *** @@ -1511,7 +1551,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:485 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:423 +packages/quickjs-ffi-types/dist/index.d.ts:425 *** @@ -1531,7 +1571,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:423 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:478 +packages/quickjs-ffi-types/dist/index.d.ts:480 *** @@ -1551,7 +1591,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:478 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:495 +packages/quickjs-ffi-types/dist/index.d.ts:499 *** @@ -1571,7 +1611,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:495 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:494 +packages/quickjs-ffi-types/dist/index.d.ts:498 *** diff --git a/doc/quickjs-emscripten/interfaces/QuickJSAsyncVariant.md b/doc/quickjs-emscripten/interfaces/QuickJSAsyncVariant.md index 29b2db4d..20da3711 100644 --- a/doc/quickjs-emscripten/interfaces/QuickJSAsyncVariant.md +++ b/doc/quickjs-emscripten/interfaces/QuickJSAsyncVariant.md @@ -36,7 +36,7 @@ build variant to [newQuickJSWASMModule](../exports.md#newquickjswasmmodule) or [ #### Source -packages/quickjs-ffi-types/dist/index.d.ts:530 +packages/quickjs-ffi-types/dist/index.d.ts:534 *** @@ -50,7 +50,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:530 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:531 +packages/quickjs-ffi-types/dist/index.d.ts:535 *** @@ -60,7 +60,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:531 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:529 +packages/quickjs-ffi-types/dist/index.d.ts:533 *** diff --git a/doc/quickjs-emscripten/interfaces/QuickJSFFI.md b/doc/quickjs-emscripten/interfaces/QuickJSFFI.md index 399d9caa..0239d3df 100644 --- a/doc/quickjs-emscripten/interfaces/QuickJSFFI.md +++ b/doc/quickjs-emscripten/interfaces/QuickJSFFI.md @@ -33,6 +33,7 @@ library. - [QTS\_FreeVoidPointer](QuickJSFFI.md#qts-freevoidpointer) - [QTS\_GetArrayBuffer](QuickJSFFI.md#qts-getarraybuffer) - [QTS\_GetArrayBufferLength](QuickJSFFI.md#qts-getarraybufferlength) + - [QTS\_GetDebugLogEnabled](QuickJSFFI.md#qts-getdebuglogenabled) - [QTS\_GetFalse](QuickJSFFI.md#qts-getfalse) - [QTS\_GetFloat64](QuickJSFFI.md#qts-getfloat64) - [QTS\_GetGlobalObject](QuickJSFFI.md#qts-getglobalobject) @@ -73,6 +74,7 @@ library. - [QTS\_RuntimeEnableModuleLoader](QuickJSFFI.md#qts-runtimeenablemoduleloader) - [QTS\_RuntimeSetMaxStackSize](QuickJSFFI.md#qts-runtimesetmaxstacksize) - [QTS\_RuntimeSetMemoryLimit](QuickJSFFI.md#qts-runtimesetmemorylimit) + - [QTS\_SetDebugLogEnabled](QuickJSFFI.md#qts-setdebuglogenabled) - [QTS\_SetProp](QuickJSFFI.md#qts-setprop) - [QTS\_TestStringArg](QuickJSFFI.md#qts-teststringarg) - [QTS\_Throw](QuickJSFFI.md#qts-throw) @@ -114,7 +116,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:346 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:404 +packages/quickjs-ffi-types/dist/index.d.ts:406 *** @@ -128,7 +130,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:404 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:402 +packages/quickjs-ffi-types/dist/index.d.ts:404 *** @@ -142,7 +144,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:402 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:401 +packages/quickjs-ffi-types/dist/index.d.ts:403 *** @@ -466,6 +468,24 @@ packages/quickjs-ffi-types/dist/index.d.ts:377 *** +### QTS\_GetDebugLogEnabled + +> **QTS\_GetDebugLogEnabled**: (`rt`) => `number` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +#### Returns + +`number` + +#### Source + +packages/quickjs-ffi-types/dist/index.d.ts:401 + +*** + ### QTS\_GetFalse > **QTS\_GetFalse**: () => [`JSValueConstPointer`](../exports.md#jsvalueconstpointer) @@ -890,7 +910,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:372 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:403 +packages/quickjs-ffi-types/dist/index.d.ts:405 *** @@ -1116,7 +1136,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:350 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:406 +packages/quickjs-ffi-types/dist/index.d.ts:408 *** @@ -1134,7 +1154,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:406 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:408 +packages/quickjs-ffi-types/dist/index.d.ts:410 *** @@ -1170,7 +1190,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:351 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:405 +packages/quickjs-ffi-types/dist/index.d.ts:407 *** @@ -1190,7 +1210,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:405 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:407 +packages/quickjs-ffi-types/dist/index.d.ts:409 *** @@ -1234,6 +1254,26 @@ packages/quickjs-ffi-types/dist/index.d.ts:349 *** +### QTS\_SetDebugLogEnabled + +> **QTS\_SetDebugLogEnabled**: (`rt`, `is_enabled`) => `void` + +#### Parameters + +• **rt**: [`JSRuntimePointer`](../exports.md#jsruntimepointer) + +• **is\_enabled**: `number` + +#### Returns + +`void` + +#### Source + +packages/quickjs-ffi-types/dist/index.d.ts:402 + +*** + ### QTS\_SetProp > **QTS\_SetProp**: (`ctx`, `this_val`, `prop_name`, `prop_value`) => `void` @@ -1332,7 +1372,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:393 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:410 +packages/quickjs-ffi-types/dist/index.d.ts:412 *** @@ -1352,7 +1392,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:410 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:409 +packages/quickjs-ffi-types/dist/index.d.ts:411 *** diff --git a/doc/quickjs-emscripten/interfaces/QuickJSSyncVariant.md b/doc/quickjs-emscripten/interfaces/QuickJSSyncVariant.md index 5e7e1222..5f0cc956 100644 --- a/doc/quickjs-emscripten/interfaces/QuickJSSyncVariant.md +++ b/doc/quickjs-emscripten/interfaces/QuickJSSyncVariant.md @@ -36,7 +36,7 @@ build variant to [newQuickJSWASMModule](../exports.md#newquickjswasmmodule) or [ #### Source -packages/quickjs-ffi-types/dist/index.d.ts:516 +packages/quickjs-ffi-types/dist/index.d.ts:520 *** @@ -50,7 +50,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:516 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:517 +packages/quickjs-ffi-types/dist/index.d.ts:521 *** @@ -60,7 +60,7 @@ packages/quickjs-ffi-types/dist/index.d.ts:517 #### Source -packages/quickjs-ffi-types/dist/index.d.ts:515 +packages/quickjs-ffi-types/dist/index.d.ts:519 *** diff --git a/doc/quickjs-emscripten/interfaces/RuntimeOptions.md b/doc/quickjs-emscripten/interfaces/RuntimeOptions.md index 73a39b32..91d9af44 100644 --- a/doc/quickjs-emscripten/interfaces/RuntimeOptions.md +++ b/doc/quickjs-emscripten/interfaces/RuntimeOptions.md @@ -35,7 +35,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) +[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) *** @@ -49,7 +49,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:112](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L112) +[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) *** @@ -63,7 +63,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) +[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) *** @@ -77,7 +77,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) +[packages/quickjs-emscripten-core/src/types.ts:115](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L115) *** @@ -87,7 +87,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:132](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L132) +[packages/quickjs-emscripten-core/src/types.ts:133](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L133) *** @@ -101,7 +101,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:116](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L116) +[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) *** @@ -115,7 +115,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) +[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) *** @@ -129,7 +129,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) +[packages/quickjs-emscripten-core/src/types.ts:120](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L120) *** diff --git a/doc/quickjs-emscripten/interfaces/RuntimeOptionsBase.md b/doc/quickjs-emscripten/interfaces/RuntimeOptionsBase.md index bbd598e9..9b35030b 100644 --- a/doc/quickjs-emscripten/interfaces/RuntimeOptionsBase.md +++ b/doc/quickjs-emscripten/interfaces/RuntimeOptionsBase.md @@ -31,7 +31,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) +[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) *** @@ -41,7 +41,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:112](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L112) +[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) *** @@ -51,7 +51,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:113](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L113) +[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) *** @@ -61,7 +61,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:114](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L114) +[packages/quickjs-emscripten-core/src/types.ts:115](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L115) *** @@ -71,7 +71,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:116](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L116) +[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) *** @@ -81,7 +81,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:117](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L117) +[packages/quickjs-emscripten-core/src/types.ts:118](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L118) *** @@ -91,7 +91,7 @@ #### Source -[packages/quickjs-emscripten-core/src/types.ts:119](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L119) +[packages/quickjs-emscripten-core/src/types.ts:120](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/types.ts#L120) *** diff --git a/doc/quickjs-emscripten/namespaces/errors/README.md b/doc/quickjs-emscripten/namespaces/errors/README.md index daf79147..9b6039da 100644 --- a/doc/quickjs-emscripten/namespaces/errors/README.md +++ b/doc/quickjs-emscripten/namespaces/errors/README.md @@ -14,6 +14,7 @@ Collects the informative errors this library may throw. - [QuickJSAsyncifyError](classes/QuickJSAsyncifyError.md) - [QuickJSAsyncifySuspended](classes/QuickJSAsyncifySuspended.md) +- [QuickJSEmptyGetOwnPropertyNames](classes/QuickJSEmptyGetOwnPropertyNames.md) - [QuickJSEmscriptenModuleError](classes/QuickJSEmscriptenModuleError.md) - [QuickJSMemoryLeakDetected](classes/QuickJSMemoryLeakDetected.md) - [QuickJSNotImplemented](classes/QuickJSNotImplemented.md) diff --git a/doc/quickjs-emscripten/namespaces/errors/classes/QuickJSEmptyGetOwnPropertyNames.md b/doc/quickjs-emscripten/namespaces/errors/classes/QuickJSEmptyGetOwnPropertyNames.md new file mode 100644 index 00000000..a1d39aba --- /dev/null +++ b/doc/quickjs-emscripten/namespaces/errors/classes/QuickJSEmptyGetOwnPropertyNames.md @@ -0,0 +1,59 @@ +[quickjs-emscripten](../../../../packages.md) • **quickjs-emscripten** • [Readme](../../../README.md) \| [Exports](../../../exports.md) + +*** + +[quickjs-emscripten](../../../../packages.md) / [quickjs-emscripten](../../../exports.md) / [errors](../README.md) / QuickJSEmptyGetOwnPropertyNames + +# Class: QuickJSEmptyGetOwnPropertyNames + +## Contents + +- [Extends](QuickJSEmptyGetOwnPropertyNames.md#extends) +- [Constructors](QuickJSEmptyGetOwnPropertyNames.md#constructors) + - [new QuickJSEmptyGetOwnPropertyNames(message)](QuickJSEmptyGetOwnPropertyNames.md#new-quickjsemptygetownpropertynamesmessage) +- [Properties](QuickJSEmptyGetOwnPropertyNames.md#properties) + - [name](QuickJSEmptyGetOwnPropertyNames.md#name) + +## Extends + +- `Error` + +## Constructors + +### new QuickJSEmptyGetOwnPropertyNames(message) + +> **new QuickJSEmptyGetOwnPropertyNames**(`message`?): [`QuickJSEmptyGetOwnPropertyNames`](QuickJSEmptyGetOwnPropertyNames.md) + +#### Parameters + +• **message?**: `string` + +#### Returns + +[`QuickJSEmptyGetOwnPropertyNames`](QuickJSEmptyGetOwnPropertyNames.md) + +#### Inherited from + +`Error.constructor` + +#### Source + +node\_modules/typescript/lib/lib.es5.d.ts:1081 + +## Properties + +### name + +> **name**: `string` = `"QuickJSEmptyGetOwnPropertyNames"` + +#### Overrides + +`Error.name` + +#### Source + +[packages/quickjs-emscripten-core/src/errors.ts:53](https://github.com/justjake/quickjs-emscripten/blob/main/packages/quickjs-emscripten-core/src/errors.ts#L53) + +*** + +Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/)