Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

promise is callback. When used in the context of the simple data loading scenario typical of D3, there is no difference.


Promises compose, bubble errors, lift sync errors, can be awaited, have combinators like Promise.all(), they're where the ecosystem headed, and more.

Thinking that promises are callbacks because .then() takes a function suggests misunderstanding.


Not exactly and not necessarily. You can await a Promise and not have any functions at all:

    await thing()
    console.log(‘Thing done’)
Also you could attach multiple callbacks to the same Promise at any point, even long after the promise fulfilled.


They aren't even executed in the same queue.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: