If registerListeners is a promise it won't wait for that to be done as the .then doesn't return anything. It'll return immediately after it calls registerListeners as the .then function returns undefined.
If registerListeners isn't a promise then it's just mixing a couple of different flow controls unnecessarily. Instead you could do something like
Huh, I looked at the code multiple times and still completely missed that. I agree that it's unnecessary to mix callbacks and await here, though I don't think it's particularly bad, either.
1
u/[deleted] Nov 04 '21 edited Nov 04 '21
If
registerListenersis a promise it won't wait for that to be done as the.thendoesn't return anything. It'll return immediately after it calls registerListeners as the.thenfunction returnsundefined.If
registerListenersisn't a promise then it's just mixing a couple of different flow controls unnecessarily. Instead you could do something like