import { SharedSettings } from "https://deno.land/x/earthstar@v10.0.2/src/entries/npm.ts";
Get and set values from a common pool of settings for Earthstar clients, such as an author, shares, share secrets, and servers.
Uses the Storage API, so only clients on the same origin will share the same settings.
Properties
private
authorChangedCbs: Set<(keypair: AuthorKeypair | null) => void>Methods
private
fireAuthorEvent()private
fireSecretsEvent()private
fireServersEvent()addSecret(shareAddress: ShareAddress, secret: string)
Add a secret for a share already known to the settings.
getPeer(unnamed 0: { sync: "once" | "continuous" | false; onCreateReplica: (addr: ShareAddress, secret?: string) => Replica; }): { peer: Peer; unsubscribeFromSettings: () => void; }
Get a new Peer
preconfigured with shares, secrets, and syncers derived from these settings.
When settings are updated, the peer's replicas and syncers will be updated too.
onAuthorChanged(cb: (keypair: AuthorKeypair | null) => void)
Fires the given callback when the stored author changes.
onServersChanged(cb: (shares: string[]) => void)
Fires the given callback when the stored list of server URLs changes.
removeServer(addressToRemove: string)
Remove a server URL from the settings' stored list of servers..