noggin

openNoggin

Open a noggin by URI. The scheme prefix (file://, memory://, localstorage://, https://, ...) selects the provider. Hosts that take a bare filesystem path from the user must convert to file:// at the boundary or call a provider-specific factory like openFileNoggin.

function openNoggin(location: string, opts?: {
  shared?: boolean;
} & Record<string, unknown>): Promise<NogginStore>;

Open a noggin by URI. The scheme prefix (e.g. file://, localstorage://, memory://) selects the provider. There is no default provider — a URI without a scheme throws code: 'no-scheme'.

Hosts that take user input as a bare filesystem path (file dialogs, drop targets, CLI flags) must convert it to a file:// URI (or use openFileNoggin from @noggin/engine/providers/file directly) before calling this.

Repeated calls with the same location return distinct handles that share the same underlying provider instance: a mutation through one handle is observed by the other (including its onDidChange), and the underlying provider is torn down only after every handle has been disposed. Pass opts.shared = false to bypass this dedupe and get an independent provider instance.

Parameters

ParameterType
locationstring
opts?{ shared?: boolean; } & Record<string, unknown>

Returns

Promise<NogginStore>