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 27 lines 548 B view raw
1import {useCallback, useRef} from 'react' 2 3type Cb = () => void 4 5export function callOnce() { 6 let ran = false 7 return function runCallbackOnce(cb: Cb) { 8 if (ran) return 9 ran = true 10 cb() 11 } 12} 13 14export function useCallOnce(cb: Cb): () => void 15export function useCallOnce(cb?: undefined): (cb: Cb) => void 16export function useCallOnce(cb?: Cb) { 17 const ran = useRef(false) 18 return useCallback( 19 (icb: Cb) => { 20 if (ran.current) return 21 ran.current = true 22 if (icb) icb() 23 else if (cb) cb() 24 }, 25 [cb], 26 ) 27}