runtime-asyncify.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { Lifetime } from ".";
  2. import { QuickJSAsyncContext } from "./context-asyncify";
  3. import { QuickJSAsyncEmscriptenModule } from "./emscripten-types";
  4. import { QuickJSAsyncFFI } from "./variants";
  5. import { JSContextPointer, JSRuntimePointer } from "./types-ffi";
  6. import { QuickJSModuleCallbacks } from "./module";
  7. import { QuickJSRuntime } from "./runtime";
  8. import { ContextOptions, JSModuleLoaderAsync, JSModuleNormalizerAsync } from "./types";
  9. export declare class QuickJSAsyncRuntime extends QuickJSRuntime {
  10. context: QuickJSAsyncContext | undefined;
  11. /** @private */
  12. protected module: QuickJSAsyncEmscriptenModule;
  13. /** @private */
  14. protected ffi: QuickJSAsyncFFI;
  15. /** @private */
  16. protected rt: Lifetime<JSRuntimePointer>;
  17. /** @private */
  18. protected callbacks: QuickJSModuleCallbacks;
  19. /** @private */
  20. protected contextMap: Map<JSContextPointer, QuickJSAsyncContext>;
  21. /** @private */
  22. constructor(args: {
  23. module: QuickJSAsyncEmscriptenModule;
  24. ffi: QuickJSAsyncFFI;
  25. rt: Lifetime<JSRuntimePointer>;
  26. callbacks: QuickJSModuleCallbacks;
  27. });
  28. newContext(options?: ContextOptions): QuickJSAsyncContext;
  29. setModuleLoader(moduleLoader: JSModuleLoaderAsync, moduleNormalizer?: JSModuleNormalizerAsync): void;
  30. /**
  31. * Set the max stack size for this runtime in bytes.
  32. * To remove the limit, set to `0`.
  33. *
  34. * Setting this limit also adjusts the global `ASYNCIFY_STACK_SIZE` for the entire {@link QuickJSAsyncWASMModule}.
  35. * See the [pull request](https://github.com/justjake/quickjs-emscripten/pull/114) for more details.
  36. */
  37. setMaxStackSize(stackSize: number): void;
  38. }