No. In this respect it's like an event that never fires. -----Original Message----- From: "Gray Zhang" <[email protected]> Sent: 2015-02-01 22:19 To: "de la Puente González Salvador" <[email protected]>; "Domenic Denicola" <[email protected]> Cc: "[email protected]" <[email protected]> Subject: RE: Should I use resolve & reject in a yes-or-no scenario
Thanks all Now I have to change my confirm method to match the “reject only for exception” rule, for some backward compatibility reason, I’d like to have a promise which “resolves when user answers OK and do nothing when user says NO”, it may cause a promise never be fulfilled (either resolve or reject), is there any potential side effect to create a never-fulfilled promise? Thanks Best regards Gray Zhang 在 2015年2月2日 上午5:46:17, de la Puente González Salvador ([email protected]) 写到: From my point of view, rejection is the way to communicate "out-of-domain" values. So, in your scenario, the domain of answers has two values "accept" and "reject" or "deny" (to avoid confusion) so you should handle these two answers in the resolved handler. Hope it helps. El 01/02/2015 17:53, "Domenic Denicola" <[email protected]> escribió: From: es-discuss [mailto:[email protected]] On Behalf Of Gray Zhang > Therefore, I’d like to ask whether we should ONLY use Promise as a > return-or-throw synonyms, or we should use it in a yes-or-no scenario You should only use the rejection channel of promises for exceptional situations, similar to what you would use synchronous exceptions for. http://www.w3.org/2001/tag/doc/promises-guide#rejections-should-be-exceptional _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

