Node.js · Middle · Question 23 of 75

How do you wait for one event as a promise?

Explanation

events.once resolves with the event arguments and rejects if the emitter emits error first. events.on gives an async iterator for many events.

Further reading

Problem with a question

Node.js · Middle · question 23

Test yourself

Take the Node.js · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz