Skip to content

Commit

Permalink
fix: Reverted code of Fire-52 (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinshahfws authored Nov 4, 2022
1 parent 7e43a5a commit c599e62
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/js/shared/Events/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,20 @@ const doListen = function(module, event, callback, context, once, internal=false

events.forEach(event => {
const key = module + '.' + event + (hasContext ? `.${contextKey}` : '')

if (Object.values(listeners.get(key)).length === 0) {
const { id, promise } = Transport.listen(module, 'on' + event[0].toUpperCase() + event.substring(1), { listen: true })
keys[id] = key
promises.push(promise)
const setter = internal ? listeners.setInternal : listeners.set
promise.then( id => {
if (wildcard) {
setter(key, ''+listenerId, value => callback(event, value))
}
else {
setter(key, ''+listenerId, callback)
}
}).catch( error => {
reject(error)
})
}

const setter = internal ? listeners.setInternal : listeners.set

if (wildcard) {
setter(key, ''+listenerId, value => callback(event, value))
}
else {
setter(key, ''+listenerId, callback)
}
})

Expand All @@ -184,7 +183,7 @@ const doListen = function(module, event, callback, context, once, internal=false
else {
resolve(listenerId)
}

return p
}
}
Expand Down

0 comments on commit c599e62

Please sign in to comment.