Options
All
  • Public
  • Public/Protected
  • All
Menu

tljs

Index

Type Aliases

WasmBinaryCallback: ((sync: boolean) => ArrayBuffer | Promise<ArrayBuffer>)

Type declaration

    • (sync: boolean): ArrayBuffer | Promise<ArrayBuffer>
    • Parameters

      • sync: boolean

      Returns ArrayBuffer | Promise<ArrayBuffer>

Functions

  • initializeWasm(): Promise<void>
  • Attempts to initialize the WebAssembly module using the registered callback

    Returns Promise<void>

  • initializeWasmSync(): void
  • Attempts to initialize the WebAssembly module using the registered callback, synchronously

    Returns void

  • Parses a string into a DOM tree.

    The first call to this function instantiates the WebAssembly module, which is quite expensive. Subsequent calls reuse the WebAssembly module. You can initialize the WebAssembly module beforehand by calling initializeWasm()

    Parameters

    Returns Promise<Dom>

  • Sets the initializer callback function.

    This can be used to override the default WebAssembly binary loading mechanism. You might want to use this if you want to load the binary from a different location (e.g. CDN), or you are using this library in the browser and require('fs') is not available.

    Parameters

    Returns void

  • setWasmExports(wasm: WasmExports): void
  • Sets the WebAssembly module.

    This sets the underlying module that is used to interact with the HTML parser written in Rust. You might want to use this if you want to use a different WebAssembly module than the one shipped with this library, or if you want to instantiate the module beforehand.

    Parameters

    • wasm: WasmExports

    Returns void

Generated using TypeDoc