Meziantou.Framework.JavaScriptEngine namespace

Classes

NameDescription
JsArrayAn Array exotic object (https://tc39.es/ecma262/#sec-array-exotic-objects): length follows the indices.
JsBinaryDataAccess to the bytes of the buffer sources (ArrayBuffer, SharedArrayBuffer, DataView and the typed arrays), without running JavaScript code.
JsBreakpointA breakpoint of a JsBreakpointDebugger (JsBreakpointDebugger.AddBreakpoint).
JsBreakpointDebuggerA debugger that pauses the scripts at breakpoints, at the debugger statements and on request, and steps through their statements. Set it in JsEngineOptions.Debugger before the code is compiled.
JsCellThe base class of the values that are not numbers nor undefined: objects, strings, symbols, BigInts, null and the booleans.
JsClassThe JavaScript class of a .NET class. The source generator derives it for each class marked with JsExportAttribute, and exposes it as the static JsClass property of the class: JsRealm.GetClass creates its constructor and its prototype in a realm.
JsConstructorAttributeSelects the constructor of the JavaScript class when a class marked with JsExportAttribute has several public constructors.
JsCyclicModuleA Cyclic Module Record (https://tc39.es/ecma262/#sec-cyclic-module-records): a module that can be part of a cycle of imports, whose dependencies are loaded, linked and evaluated with it. A JsSourceTextModule is parsed from JavaScript source text; a JsHostDefinedModule is defined by the host (e.g. a WebAssembly module).
JsDebugFrameA JavaScript frame of the stack of a statement given to a JsDebugger: a function call, or the top-level code of a script, a module or eval code (JsDebugEvent.GetCallStack). It can be used until the callback that received the event returns.
JsDebugScopeA scope of a frame paused by a debugger (JsDebugFrame.GetScopes): its variables, or its binding object.
JsDebuggerReceives the execution events of the scripts of an engine, to build a debugger, a code coverage tool or an execution inspector. Set it in JsEngineOptions.Debugger before the code is compiled.
JsEngineAn ECMAScript agent (https://tc39.es/ecma262/#sec-agents): it owns the realms, the job queue and the execution limits of the scripts it runs. An engine is used by one thread at a time.
JsEngineOptionsThe options of a JsEngine: the limits of the scripts and the host services.
JsExceptionA JavaScript exception: the .NET exception that carries a thrown JavaScript value.
JsExecutionLimitsThe limits of an execution scope (JsEngine.EnterExecutionScope): they apply to all the code that runs in the scope as a whole (the scripts, the calls, the jobs, the parsing of the sources), in addition to the limits of JsEngineOptions. A limit that is exceeded stops the code with a JsTerminationException.
JsExecutionScopeThe scope returned by JsEngine.EnterExecutionScope: the calls made until it is disposed are one entry into JavaScript, bounded by its JsExecutionLimits. Dispose the scopes in the reverse order they were entered, on the thread that entered them.
JsExportAttributeGenerates the JavaScript binding of a class: a source generator adds a static JsClass property to the class, which JsRealm.GetClass turns into a JavaScript class. The class and its containing types must be partial.
JsFunctionA JavaScript function: an object with a [[Call]] internal method, and possibly a [[Construct]] internal method.
JsHostThe host-defined operations of the engine (https://tc39.es/ecma262/#sec-host-hooks-summary). The default implementations are the ones of the specification; a host (e.g. a browser) derives from this class to integrate the engine with its event loop, and sets it in JsEngineOptions.Host.
JsHostDefinedModuleA cyclic module defined by the host (e.g. a WebAssembly Module Record, https://webassembly.github.io/esm-integration/js-api/index.html#integration-with-ecmascript-modules): its dependencies are loaded, linked and evaluated before it, like the imports of a JavaScript module, and it can be part of a cycle. Its exports are uninitialized bindings until the host sets them, when the module is evaluated.
JsHostJobA job that the engine gives to the host to schedule (HostEnqueueGenericJob, HostEnqueueTimeoutJob): the host calls JsHostJob.Run later, on the thread of the engine (e.g. from a task of its event loop).
JsHostObjectAn object implemented by the host (e.g. a platform object of a browser): a derived class can override its internal methods (https://tc39.es/ecma262/#sec-object-internal-methods-and-internal-slots). The default implementations are the ones of an ordinary object, also available with the Ordinary* methods.
JsIgnoreAttributeHides a public member of a class marked with JsExportAttribute from the scripts.
JsModuleA Module Record (https://tc39.es/ecma262/#sec-abstract-module-records). A module is loaded (JsModule.LoadRequestedModules), linked (JsModule.Link), then evaluated (JsModule.Evaluate).
JsModuleBindingA binding exported by a module (a ResolvedBinding Record, https://tc39.es/ecma262/#resolvedbinding-record): a binding of the environment of JsModuleBinding.Module, or its namespace object. Returned by JsHostDefinedModule.GetImport.
JsModuleLoadRequestA request to load a module (the arguments of HostLoadImportedModule).
JsModuleLoaderLoads the modules imported by the scripts and the modules (HostLoadImportedModule, https://tc39.es/ecma262/#sec-HostLoadImportedModule). Set it in JsEngineOptions.ModuleLoader.
JsNameAttributeSets the JavaScript name of a member of a class marked with JsExportAttribute, instead of its camelCase name.
JsObjectA JavaScript object. The internal methods (https://tc39.es/ecma262/#sec-object-internal-methods-and-internal-slots) implement the ordinary object behavior; the exotic objects (arrays, proxies, arguments, typed arrays...) override them.
JsPreparedScriptA parsed and compiled script. It is immutable: it can run in several realms and engines, on several threads (e.g. the scripts of a test harness, parsed once for all the pages). The syntax errors of the whole script are reported by JsPreparedScript.Parse, but the body of a nested function is compiled on its first call (once, whichever engine calls it).
JsPromiseRejectionEventArgsThe arguments of JsEngine.UnhandledRejection and JsEngine.RejectionHandled.
JsProxyA Proxy exotic object (https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots): its internal methods call the traps of its handler, and check the invariants of the internal methods against its target.
JsRealmA realm (https://tc39.es/ecma262/#sec-code-realms): a global object, its global environment and the intrinsics.
JsScriptA Script Record (https://tc39.es/ecma262/#sec-script-records).
JsScriptOrModuleA script or a module: the [[ScriptOrModule]] of the running code (https://tc39.es/ecma262/#sec-getactivescriptormodule).
JsSharedDataBlockA Shared Data Block (https://tc39.es/ecma262/#sec-data-blocks): the memory of a SharedArrayBuffer. It can be shared by several engines (agents) running on different threads, e.g. by the structured clone of a SharedArrayBuffer sent to a worker. The memory is a managed array allocated once for the maximum byte length on the pinned object heap: a growable block never moves, its byte length grows atomically. The bytes are 16-byte aligned (the atomic operations of 64-bit values are aligned). The spans, references and memories of the block reference the array, so they keep the memory alive by themselves, even once no SharedArrayBuffer references the block.
JsSharedDataBlockWaitersThe waiters of a JsSharedDataBlock whose memory is shared with another runtime that has its own waiters, such as a shared WebAssembly memory (the memory.atomic.wait32 and memory.atomic.notify instructions use the waiters of the WebAssembly runtime). Atomics.wait, Atomics.waitAsync and Atomics.notify use them instead of the waiter lists of the engines, so that the waiters of both runtimes are notified by both of them.
JsSourceMapA source map (https://tc39.es/ecma426/, version 3): the positions of the original sources of a generated script, such as a bundle or the output of a compiler. Use it with a JsSourceMapper to show the errors of the script at their original positions.
JsSourceMapperMaps the positions of generated scripts (bundles, the output of a compiler) to their original sources with source maps: the location of a JsException and the stack traces. It does not change the execution of the scripts: the errors and the stack property that the scripts see keep the generated positions.
JsSourceTextModuleA Source Text Module Record (https://tc39.es/ecma262/#sec-source-text-module-records): a module parsed from JavaScript source text.
JsSymbolA JavaScript symbol. Two symbols are the same value only if they are the same instance.
JsSyntaxErrorExceptionThe exception thrown when a source text is not a valid script or module (an early error or a syntax error).
JsSyntheticModuleA Synthetic Module Record (https://tc39.es/ecma262/#sec-synthetic-module-records): a module whose exports are set by the host (e.g. a JSON module).
JsTerminationExceptionThe exception thrown when the engine stops a script: a limit is exceeded or the execution is canceled. The scripts cannot catch it (the catch and finally blocks do not run).

Structs

NameDescription
JsContinuationA handler created by the engine for a promise reaction (e.g. the continuation of an await), which the host calls from JsHost.CallContinuation to restore the state it captured with JsHost.MakeContinuationHostDefined.
JsDebugEventA statement that is about to run, given to the methods of JsDebugger.
JsDebugPauseA script paused by a JsBreakpointDebugger.
JsDebugVariableA variable of a JsDebugScope.
JsEngineScopeThe scope returned by JsEngine.Enter: disposing it restores the previous engine of the thread.
JsFunctionSourceLocationWhere a function was defined (see JsObject.GetFunctionSourceLocation).
JsJobCallbackA JobCallback Record (https://tc39.es/ecma262/#sec-jobcallback-records): a function and the host-defined state captured when it was registered.
JsPropertyDescriptorA property descriptor (https://tc39.es/ecma262/#sec-property-descriptor-specification-type): complete, or partial (the argument of Object.defineProperty).
JsPropertyKeyA property key: a string or a symbol (https://tc39.es/ecma262/#sec-object-type).
JsScriptContextScopeThe scope returned by JsEngine.EnterActiveScriptOrModule: disposing it pops the execution context.
JsSourceLocationA position in the source text of a script or a module: its URL, and the 1-based line and column.
JsValueA JavaScript value: undefined, null, a boolean, a number, a string, a symbol, a BigInt or an object. The default value is undefined. Numbers are not allocated; the other values reference a JsCell.

Interfaces

NameDescription
IJsExportableAn instance of a class marked with JsExportAttribute: the source generator implements this interface. JsRealm.FromDotNet converts the instance to an object of its JavaScript class, and JsEngine.ToDotNet converts the object back to the instance.

Enums

NameDescription
JsBufferKindThe kinds of buffer sources: ArrayBuffer, SharedArrayBuffer, DataView and the typed arrays.
JsCompilationTypeThe kind of a compilation of a string by the scripts (HostEnsureCanCompileStrings).
JsDebugScopeKindThe kind of a JsDebugScope.
JsErrorTypeThe native error types (https://tc39.es/ecma262/#sec-native-error-types-used-in-this-standard).
JsInternalSlotThe internal slots of the built-in objects (JsObject.HasInternalSlot).
JsModuleStatusThe [[Status]] of a module (https://tc39.es/ecma262/#sec-cyclic-module-records).
JsPauseReasonWhy a JsBreakpointDebugger paused a script.
JsPromiseRejectionOperationThe operation of HostPromiseRejectionTracker.
JsPromiseStateThe state of a promise ([[PromiseState]]).
JsPropertyDescriptorFlagsThe fields and attributes of a JsPropertyDescriptor.
JsStepActionHow a script paused by a JsBreakpointDebugger resumes.
JsTerminationReasonWhy the engine stopped a script.
JsValueKindThe type of a JavaScript value (https://tc39.es/ecma262/#sec-ecmascript-language-types).

Delegates

NameDescription
JsNativeConstructorThe implementation of a constructor of the host: newTarget is null for [[Call]], and the new.target of [[Construct]] otherwise.
JsNativeFunctionThe implementation of a function of the host: returns the result of a call with thisValue and arguments.