API reference › @evolu/common › local‑first/Shared › SharedWorkerOutput

type SharedWorkerOutput =
  | DbWorkerInit
  | {
      error:
        | DatabaseHeldError
        | OtherBuildRunningError
        | UnknownError
        | UnsupportedDbVersionError;
      type: "Error";
    }
  | {
      type: "Waiting";
      workerId: SharedWorkerId;
    }
  | {
      syncStateChannelName: string;
      type: "Connected";
      workerId: SharedWorkerId;
    };

Defined in: packages/common/src/local-first/Shared.ts:448

Union Members

DbWorkerInit


Type Literal

{
  error:   | DatabaseHeldError
     | OtherBuildRunningError
     | UnknownError
     | UnsupportedDbVersionError;
  type: "Error";
}
NameTypeDescriptionDefined in
error| DatabaseHeldError | OtherBuildRunningError | UnknownError | UnsupportedDbVersionError-packages/common/src/local-first/Shared.ts:456
type"Error"Sent to one tab only: its database is refused, a mutation it made could not be stored, or another build keeps this worker waiting.packages/common/src/local-first/Shared.ts:455

Type Literal

{
  type: "Waiting";
  workerId: SharedWorkerId;
}
NameTypeDescriptionDefined in
type"Waiting"Sent to a tab that connects while the worker waits for the build lock; see Builds. Connected follows once the worker holds it.packages/common/src/local-first/Shared.ts:467
workerIdSharedWorkerId-packages/common/src/local-first/Shared.ts:468

Type Literal

{
  syncStateChannelName: string;
  type: "Connected";
  workerId: SharedWorkerId;
}
NameTypeDescriptionDefined in
syncStateChannelNamestring-packages/common/src/local-first/Shared.ts:479
type"Connected"Sent to a connecting tab once the worker holds the build lock; see Builds in this module's documentation. The tab elects the host of the worker's DbWorkers among the worker's tabs, scoped by workerId, and listens for SyncState on syncStateChannelName.packages/common/src/local-first/Shared.ts:477
workerIdSharedWorkerId-packages/common/src/local-first/Shared.ts:478