Skip to main content

wrapSynchronousInterfaceAsPromised

Callable

  • wrapSynchronousInterfaceAsPromised<T>(obj: T): Promised<T>

  • Wraps a synchronous interface as a promised interface.

    This function tries to avoid wrapping methods inherited from built-in JS object types (e.g., Object, Array, Function, etc.).

    The initial use case for this function is for unit testing file locking in php-wasm. Php-wasm for JSPI expects the file lock manager to be a promised interface used via comlink, but the interface itself is synchronous.


    Type parameters

    • T: object

    Parameters

    • obj: T

    Returns Promised<T>

    A promised interface that wraps the synchronous interface.