3 ms·
Between callback functions and promises, I've seen a general shift toward preferring promises, as you said, even for native DOM APIs. Using then/catch/finally o
by lioeters 9y ago
Between callback functions and promises, I've seen a general shift toward preferring promises, as you said, even for native DOM APIs. Using then/catch/finally or async/await is easier to work with, I think, especially for a series of async actions.
Event emitters are for a different range of use cases, I'd say: when you're expecting to send/receive a number of events, or multiple event types - for a duration of time, possibly open-ended like AJAX or WebSocket connection.