this repo has no description sites.wisp.place/zzstoatzz.io/pds-message-poc
pds messaging
at main 39 lines 940 B view raw
1import { writable } from 'svelte/store'; 2import { createClients, LabelerClient } from './client.js'; 3 4// global labeler instance using real ATProto labeler 5export const labeler = new LabelerClient(); 6 7// network of PDS clients (populated on init) 8export let network = {}; 9 10// initialize all PDS clients 11export async function initNetwork() { 12 network = await createClients(); 13} 14 15// get PDS by handle 16export function getPds(handle) { 17 return network[handle]; 18} 19 20// get PDS by DID 21export function getPdsByDid(did) { 22 return Object.values(network).find((p) => p.did === did); 23} 24 25// event log entries 26export const logs = writable([{ msg: 'connecting to PDS...', cls: 'dim' }]); 27 28export function log(msg, cls = '') { 29 logs.update((l) => [...l, { msg, cls }]); 30} 31 32// trigger reactivity after mutations 33export const tick = writable(0); 34export function refresh() { 35 tick.update((n) => n + 1); 36} 37 38// ready state 39export const ready = writable(false);