use getters
This commit is contained in:
parent
98bb44042e
commit
59a238b3c7
1 changed files with 4 additions and 14 deletions
|
|
@ -432,12 +432,6 @@ const onOutgoing = cb => {
|
||||||
/** @type {Outgoings} */
|
/** @type {Outgoings} */
|
||||||
let outgoings = {}
|
let outgoings = {}
|
||||||
|
|
||||||
/** @type {Streams.Avatars} */
|
|
||||||
let pubToAvatar = {}
|
|
||||||
|
|
||||||
/** @type {Streams.DisplayNames} */
|
|
||||||
let pubToDn = {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {(chats: Chat[]) => void} ChatsListener
|
* @typedef {(chats: Chat[]) => void} ChatsListener
|
||||||
*/
|
*/
|
||||||
|
|
@ -453,6 +447,8 @@ const notifyChatsListeners = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const processChats = () => {
|
const processChats = () => {
|
||||||
|
const pubToAvatar = Streams.getPubToAvatar()
|
||||||
|
const pubToDn = Streams.getPubToDn()
|
||||||
const existingOutgoings = /** @type {[string, Outgoing][]} */ (Object.entries(
|
const existingOutgoings = /** @type {[string, Outgoing][]} */ (Object.entries(
|
||||||
outgoings
|
outgoings
|
||||||
).filter(([_, o]) => o !== null))
|
).filter(([_, o]) => o !== null))
|
||||||
|
|
@ -521,14 +517,8 @@ const onChats = cb => {
|
||||||
processChats()
|
processChats()
|
||||||
})
|
})
|
||||||
|
|
||||||
Streams.onAvatar(pta => {
|
Streams.onAvatar(processChats)
|
||||||
pubToAvatar = pta
|
Streams.onDisplayName(processChats)
|
||||||
processChats()
|
|
||||||
})
|
|
||||||
Streams.onDisplayName(ptd => {
|
|
||||||
pubToDn = ptd
|
|
||||||
processChats()
|
|
||||||
})
|
|
||||||
Streams.onIncoming(processChats)
|
Streams.onIncoming(processChats)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue