werkbank
    Preparing search index...

    Function expose

    • Creates a worker instance that exposes a module via RPC.

      Type Parameters

      Parameters

      • config: C

        The worker configuration containing the module implementation.

      Returns Promise<Observable<Event<unknown>>> & { $config: C }

      The worker instance.

      This function sets up the message listeners for the worker (Dedicated or Shared) and handles the connection lifecycle. It returns the event stream which contains the client configuration.

      const api = {
      hello: () => "world"
      };

      expose(api);