HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/node_modules/pm2/node_modules/@tootallnate/quickjs-emscripten/dist/context-asyncify.d.ts
import { QuickJSContext } from "./context";
import { QuickJSAsyncEmscriptenModule } from "./emscripten-types";
import { QuickJSAsyncFFI } from "./variants";
import { JSRuntimePointer } from "./types-ffi";
import { Lifetime } from "./lifetime";
import { QuickJSModuleCallbacks } from "./module";
import { QuickJSAsyncRuntime } from "./runtime-asyncify";
import { ContextEvalOptions, QuickJSHandle } from "./types";
import { VmCallResult } from "./vm-interface";
export type AsyncFunctionImplementation = (this: QuickJSHandle, ...args: QuickJSHandle[]) => Promise<QuickJSHandle | VmCallResult<QuickJSHandle> | void>;
/**
 * Asyncified version of [[QuickJSContext]].
 *
 * *Asyncify* allows normally synchronous code to wait for asynchronous Promises
 * or callbacks. The asyncified version of QuickJSContext can wait for async
 * host functions as though they were synchronous.
 */
export declare class QuickJSAsyncContext extends QuickJSContext {
    runtime: QuickJSAsyncRuntime;
    /** @private */
    protected module: QuickJSAsyncEmscriptenModule;
    /** @private */
    protected ffi: QuickJSAsyncFFI;
    /** @private */
    protected rt: Lifetime<JSRuntimePointer>;
    /** @private */
    protected callbacks: QuickJSModuleCallbacks;
    /**
     * Asyncified version of [[evalCode]].
     */
    evalCodeAsync(code: string, filename?: string, 
    /** See [[EvalFlags]] for number semantics */
    options?: number | ContextEvalOptions): Promise<VmCallResult<QuickJSHandle>>;
    /**
     * Similar to [[newFunction]].
     * Convert an async host Javascript function into a synchronous QuickJS function value.
     *
     * Whenever QuickJS calls this function, the VM's stack will be unwound while
     * waiting the async function to complete, and then restored when the returned
     * promise resolves.
     *
     * Asyncified functions must never call other asyncified functions or
     * `import`, even indirectly, because the stack cannot be unwound twice.
     *
     * See [Emscripten's docs on Asyncify](https://emscripten.org/docs/porting/asyncify.html).
     */
    newAsyncifiedFunction(name: string, fn: AsyncFunctionImplementation): QuickJSHandle;
}