Add a type
This commit is contained in:
committed by
Samuel Newman
parent
d3b0452401
commit
fef1bad264
Vendored
+6
-2
@@ -53,8 +53,9 @@ const shadows: WeakMap<
|
|||||||
> = new WeakMap()
|
> = new WeakMap()
|
||||||
const emitter = new EventEmitter()
|
const emitter = new EventEmitter()
|
||||||
|
|
||||||
|
type ShadowUpdateEventPayload = {did: string; shadow: Partial<ProfileShadow>}
|
||||||
export function useOnUpdateProfileShadow(
|
export function useOnUpdateProfileShadow(
|
||||||
onUpdate: (props: {did: string; shadow: Partial<ProfileShadow>}) => void,
|
onUpdate: (payload: ShadowUpdateEventPayload) => void,
|
||||||
) {
|
) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
emitter.addListener('shadow-update', onUpdate)
|
emitter.addListener('shadow-update', onUpdate)
|
||||||
@@ -217,7 +218,10 @@ export function updateProfileShadow(
|
|||||||
}
|
}
|
||||||
batchedUpdates(() => {
|
batchedUpdates(() => {
|
||||||
emitter.emit(did, value)
|
emitter.emit(did, value)
|
||||||
emitter.emit('shadow-update', {did, shadow: value})
|
emitter.emit('shadow-update', {
|
||||||
|
did,
|
||||||
|
shadow: value,
|
||||||
|
} satisfies ShadowUpdateEventPayload)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user