Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
119
fork

Configure Feed

Select the types of activity you want to include in your feed.

at a876aae44ea07494ebea9727350aa060b81f317b 26 lines 605 B view raw
1import {timeout} from './timeout' 2 3export async function until<T>( 4 retries: number, 5 delay: number, 6 cond: (v: T, err: any) => boolean, 7 fn: () => Promise<T>, 8): Promise<boolean> { 9 while (retries > 0) { 10 try { 11 const v = await fn() 12 if (cond(v, undefined)) { 13 return true 14 } 15 } catch (e: any) { 16 // TODO: change the type signature of cond to accept undefined 17 // however this breaks every existing usage of until -sfn 18 if (cond(undefined as unknown as T, e)) { 19 return true 20 } 21 } 22 await timeout(delay) 23 retries-- 24 } 25 return false 26}