avoid possible circular dependency bug

This commit is contained in:
Daniel Lugo 2020-02-27 17:11:01 -04:00
parent 1bb96c395a
commit ff1589e644

View file

@ -7,7 +7,6 @@ const logger = require('winston')
const ErrorCode = require('../errorCode') const ErrorCode = require('../errorCode')
const Key = require('../key') const Key = require('../key')
const Schema = require('../schema') const Schema = require('../schema')
const Streams = require('../streams')
const Utils = require('../utils') const Utils = require('../utils')
/** /**
* @typedef {import('../SimpleGUN').UserGUNNode} UserGUNNode * @typedef {import('../SimpleGUN').UserGUNNode} UserGUNNode
@ -455,6 +454,7 @@ const notifyChatsListeners = () => {
} }
const processChats = debounce(() => { const processChats = debounce(() => {
const Streams = require('../streams')
const pubToAvatar = Streams.getPubToAvatar() const pubToAvatar = Streams.getPubToAvatar()
const pubToDn = Streams.getPubToDn() const pubToDn = Streams.getPubToDn()
const existingOutgoings = /** @type {[string, Outgoing][]} */ (Object.entries( const existingOutgoings = /** @type {[string, Outgoing][]} */ (Object.entries(
@ -526,12 +526,12 @@ const onChats = cb => {
cb(currentChats) cb(currentChats)
if (!onChatsSubbed) { if (!onChatsSubbed) {
const Streams = require('../streams')
onChatsSubbed = true
onOutgoing(processChats) onOutgoing(processChats)
Streams.onAvatar(processChats) Streams.onAvatar(processChats)
Streams.onDisplayName(processChats) Streams.onDisplayName(processChats)
Streams.onPubToFeed(processChats) Streams.onPubToFeed(processChats)
onChatsSubbed = true
} }
return () => { return () => {