Dialog.done should return itself for chaining#4087
Conversation
|
Hmmm, I'm not 100% sure about this. If we want it to feel like the promise case, then it seems like |
|
Well, then you lose the reference to the Dialog. Anyway, I'm certainly not going to go to the mat on this one. I like it, but maybe nobody else does! |
|
I like the idea. I think I wrote something like that in the brackets-edge-web-fonts extension. It would be easy to get the promise in a chained way right after the done to with |
|
I'm with @njx on this in feeling ambivalent about this change. Given how often we have That said, the dialog can't fail. No one would need to add a |
|
Hmm... the change in #4102 actually appears to be fixing a case where the return value was treated like a promise. So, maybe the problem I fear has actually already occurred. |
|
Filed #4125. I don't believe we use chaining that much in our own APIs. I understand that |
|
Closing this out because everybody hates it. Some day I'll show you all! |
With the the recent modal dialog changes,
Dialogs.showModalDialogUsingTemplate()returns aDialogobject that encapsulates a jQuery object representing the displayed dialog and a dismissal promise. For convenience and some measure of compatibility with the previous implementation, theDialogobject directly exposes thedone()method of its promise.This is great, but it would be even better if the
Dialog.done()returned itself to support the following idiom:I like this because it reminds me of the promise chaining idiom that
Dialog.done()mimicks.This pull request just adds
return this;to the definition ofDialog.prototype.doneto accomplish this.CC @TomMalbran