- From: Jafar Husain <notifications@github.com>
- Date: Thu, 14 Dec 2017 18:41:39 +0000 (UTC)
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/544/351799455@github.com>
I would favor removing first() and any other Promise-returning methods over making the `on` API inaccessible. The primary benefit of this proposal is improving subscription APIs for DOM events, and the ability to adapt to Promises is secondary. However I think we must realistically deal with the fact that developers will resolve Promises in response to DOM events. The choice is either to provide APIs to help them do this correctly (ex. do), or leave them to their own devices to do it themselves. If we do the former we can document these methods and educate developers about the hazards of adaptation. On Dec 14, 2017 10:20 AM, "Maciej Stachowiak" <notifications@github.com> wrote: I'm not sure if the downsides outweigh the benefits. It should be pretty obvious that I'm not familiar with this API, so I'm not in a position to give a considered opinion yet. I do note that this issue is titled "Improving ergonomics of events with Observable", which implies to me that it's meant to make things easier for everyday use of events by typical developers, not just for advanced use cases where it is possible to be careful and get things right. Based on that, I expect it needs to be designed to be minimally dangerous to non-expert web developers. In that context, "there are some use cases where it's convenient and safe" is not a good answer to "this seems to create the risk of unexpected or unpredictable behavior". There might be ways of getting events into the Promise ecosystem that create less risk of mistakes. Even something as simple as giving first() a different name might do it. Alternately, if this API is meant only for expert use, there's the possibility of giving on() a more off-putting name like observableForEvent(). — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <https://github.com/whatwg/dom/issues/544#issuecomment-351793996>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAcfr3kyFAki-ZjdE394D1Ns41Nc15shks5tAWbYgaJpZM4RADEv> . -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/544#issuecomment-351799455
Received on Thursday, 14 December 2017 18:43:34 UTC