platform-bible-utils
    Preparing search index...

    Function createSyncProxyForAsyncObject

    • Creates a synchronous proxy for an asynchronous object. The proxy allows calling methods on an object that is asynchronously fetched using a provided asynchronous function.

      Type Parameters

      • T extends object

      Parameters

      • getObject: (args?: unknown[]) => Promise<T>

        A function that returns a promise resolving to the object whose asynchronous methods to call.

      • objectToProxy: Partial<T> = {}

        An optional object that is the object that is proxied. If a property is accessed that does exist on this object, it will be returned. If a property is accessed that does not exist on this object, it will be considered to be an asynchronous method called on the object returned from getObject.

      Returns T

      A synchronous proxy for the asynchronous object.