I was needing to handle an "error" callback for an xhr post, and found
there is no #onError: handler in JQPost. Went to jQuery website I noticed most of the success/fail/complete methods in JQAjax hierarchy are deprecated. Deprecation Notice The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods introduced in jQuery 1.5 aredeprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead. Is anybody updating JQuery wrapper for that? Or is there already a way to deal with the new "promise" style way of chaining callbacks?. What I'm doing now is something like: ((html jQuery post callback: [] value: ()) call: 'done' with: ("js function")) call: 'fail' with: ("fail function") Regards! Esteban A. Maringolo _______________________________________________ seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
I did an update when Seaside 3.1.1 was released but I may have missed these.
Can you make an issue that I can handle when I come back from holidays? Johan (sent from my mobile) > On 18 Jul 2014, at 17:46, "Esteban A. Maringolo" <[hidden email]> wrote: > > I was needing to handle an "error" callback for an xhr post, and found > there is no #onError: handler in JQPost. Went to jQuery website I > noticed most of the success/fail/complete methods in JQAjax hierarchy > are deprecated. > > Deprecation Notice > The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback > methods introduced in jQuery 1.5 aredeprecated as of jQuery 1.8. To > prepare your code for their eventual removal, use jqXHR.done(), > jqXHR.fail(), and jqXHR.always() instead. > > Is anybody updating JQuery wrapper for that? Or is there already a way > to deal with the new "promise" style way of chaining callbacks?. > > What I'm doing now is something like: > ((html jQuery post callback: [] value: ()) call: 'done' with: ("js > function")) call: 'fail' with: ("fail function") > > Regards! > > > Esteban A. Maringolo > _______________________________________________ > seaside-dev mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
In reply to this post by Esteban A. Maringolo
Reading through the documentation, it seems we could easily make this jQuery deprecation transparant for Seaside users:
- onComplete option -> always callback - onSuccess option -> done callback - onError option -> fail callback Since the return value of the existing methods on JQAjaxSetup was self already (i.e. the JQAjaxSetup subinstance), making this a transparant change is possible by converting it to add a corresponding function call decoration on the jQAjaxSetup instance, which returns self as well and allows to chain the messages in exactly the same way as they were done before. So the implementation of onComplete would be JQAjaxSetup>>onComplete: aJSObject self call: 'always' with: ajSObject asFunction Although this is a good thing for continuity, it's probably a bad idea to keep the old method names and rather make everyone use onFail:, onDone: and onAlways: instead (not sure about the last one though...). Thoughts? Johan On 18 Jul 2014, at 17:46, Esteban A. Maringolo <[hidden email]> wrote: > I was needing to handle an "error" callback for an xhr post, and found > there is no #onError: handler in JQPost. Went to jQuery website I > noticed most of the success/fail/complete methods in JQAjax hierarchy > are deprecated. > > Deprecation Notice > The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback > methods introduced in jQuery 1.5 aredeprecated as of jQuery 1.8. To > prepare your code for their eventual removal, use jqXHR.done(), > jqXHR.fail(), and jqXHR.always() instead. > > Is anybody updating JQuery wrapper for that? Or is there already a way > to deal with the new "promise" style way of chaining callbacks?. > > What I'm doing now is something like: > ((html jQuery post callback: [] value: ()) call: 'done' with: ("js > function")) call: 'fail' with: ("fail function") > > Regards! > > > Esteban A. Maringolo > _______________________________________________ > seaside-dev mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev _______________________________________________ seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
Johan: I don't have expertise in Seaside versioning, so I can't imagine how a minor change would impact third party systems. Having said that I find your proposal appropiate.
One thing that doesn't translate properly is the "always" callback. #onComplete: -> always -> #ensure:/#always: ? #onSuccess -> done -> onDone:
#onError -> fail -> onFail: I would do: JQAjaxSetup>>onError: aJSObject self greaseDeprecatedApi: '...' details: '...'.
self onFail: aJSObject Another, more complex, path is to model the JS Promise (JSPromise?), which can be useful for future uses and libraries (http://promisesaplus.com/).
Regards!
Esteban A. Maringolo
2014-07-28 17:09 GMT-03:00 Johan Brichau <[hidden email]>: Reading through the documentation, it seems we could easily make this jQuery deprecation transparant for Seaside users: _______________________________________________ seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
Hi,
I took a closer look at the jQuery API documentation and I think there is some confusion. The onComplete, onSuccess and onError options of $.ajax() are not deprecated. These options are used by the corresponding methods on JQAjax and thus do not require any change. The deprecated functions in jQuery are callbacks of the jqXHR object which have never been included in the Seaside wrapper implementation. My conclusion is thus to simply add the new callbacks to the jQuery wrapper. cheers, Johan On 29 Jul 2014, at 00:49, Esteban A. Maringolo <[hidden email]> wrote: > Johan: > > I don't have expertise in Seaside versioning, so I can't imagine how a minor change would impact third party systems. > Having said that I find your proposal appropiate. > > One thing that doesn't translate properly is the "always" callback. > > #onComplete: -> always -> #ensure:/#always: ? > #onSuccess -> done -> onDone: > #onError -> fail -> onFail: > > I would do: > > JQAjaxSetup>>onError: aJSObject > > self greaseDeprecatedApi: '...' details: '...'. > self onFail: aJSObject > > > Another, more complex, path is to model the JS Promise (JSPromise?), which can be useful for future uses and libraries (http://promisesaplus.com/). > > > Regards! > > > > > > > > > > Esteban A. Maringolo > > > 2014-07-28 17:09 GMT-03:00 Johan Brichau <[hidden email]>: > Reading through the documentation, it seems we could easily make this jQuery deprecation transparant for Seaside users: > > - onComplete option -> always callback > - onSuccess option -> done callback > - onError option -> fail callback > > Since the return value of the existing methods on JQAjaxSetup was self already (i.e. the JQAjaxSetup subinstance), making this a transparant change is possible by converting it to add a corresponding function call decoration on the jQAjaxSetup instance, which returns self as well and allows to chain the messages in exactly the same way as they were done before. > > So the implementation of onComplete would be > > JQAjaxSetup>>onComplete: aJSObject > self call: 'always' with: ajSObject asFunction > > Although this is a good thing for continuity, it's probably a bad idea to keep the old method names and rather make everyone use onFail:, onDone: and onAlways: instead (not sure about the last one though...). > > Thoughts? > > Johan > > On 18 Jul 2014, at 17:46, Esteban A. Maringolo <[hidden email]> wrote: > > > I was needing to handle an "error" callback for an xhr post, and found > > there is no #onError: handler in JQPost. Went to jQuery website I > > noticed most of the success/fail/complete methods in JQAjax hierarchy > > are deprecated. > > > > Deprecation Notice > > The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback > > methods introduced in jQuery 1.5 aredeprecated as of jQuery 1.8. To > > prepare your code for their eventual removal, use jqXHR.done(), > > jqXHR.fail(), and jqXHR.always() instead. > > > > Is anybody updating JQuery wrapper for that? Or is there already a way > > to deal with the new "promise" style way of chaining callbacks?. > > > > What I'm doing now is something like: > > ((html jQuery post callback: [] value: ()) call: 'done' with: ("js > > function")) call: 'fail' with: ("fail function") > > > > Regards! > > > > > > Esteban A. Maringolo > > _______________________________________________ > > seaside-dev mailing list > > [hidden email] > > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev > > _______________________________________________ > seaside-dev mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev > > _______________________________________________ > seaside-dev mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev _______________________________________________ seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
I'm not totally sure about the "not deprecation" status of such methods.
While it's true that done() and friends are methods of $.ajax, it is also true that for $.post [1] and $.get [2] the documentation only provides a convenience constructor for the "success" callback, everything else must be implemented in terms of the promise style interface, using done(), fail() and always(). I had to implement a failure handler (any code other than 2xx) for a JQPost and I wrapped it with a call to fail() to handle the POST failures, I couldn't find any other way to do it. I have no expertise to say whether to include it or not in the Seaside helper classes. [1] http://api.jquery.com/jQuery.post/ [2] http://api.jquery.com/jQuery.get/ Thanks for your support! Esteban A. Maringolo 2014-08-20 7:33 GMT-03:00 Johan Brichau <[hidden email]>: > Hi, > > I took a closer look at the jQuery API documentation and I think there is some confusion. > > The onComplete, onSuccess and onError options of $.ajax() are not deprecated. These options are used by the corresponding methods on JQAjax and thus do not require any change. > The deprecated functions in jQuery are callbacks of the jqXHR object which have never been included in the Seaside wrapper implementation. > > My conclusion is thus to simply add the new callbacks to the jQuery wrapper. > > cheers, > Johan > > On 29 Jul 2014, at 00:49, Esteban A. Maringolo <[hidden email]> wrote: > >> Johan: >> >> I don't have expertise in Seaside versioning, so I can't imagine how a minor change would impact third party systems. >> Having said that I find your proposal appropiate. >> >> One thing that doesn't translate properly is the "always" callback. >> >> #onComplete: -> always -> #ensure:/#always: ? >> #onSuccess -> done -> onDone: >> #onError -> fail -> onFail: >> >> I would do: >> >> JQAjaxSetup>>onError: aJSObject >> >> self greaseDeprecatedApi: '...' details: '...'. >> self onFail: aJSObject >> >> >> Another, more complex, path is to model the JS Promise (JSPromise?), which can be useful for future uses and libraries (http://promisesaplus.com/). >> >> >> Regards! >> >> >> >> >> >> >> >> >> >> Esteban A. Maringolo >> >> >> 2014-07-28 17:09 GMT-03:00 Johan Brichau <[hidden email]>: >> Reading through the documentation, it seems we could easily make this jQuery deprecation transparant for Seaside users: >> >> - onComplete option -> always callback >> - onSuccess option -> done callback >> - onError option -> fail callback >> >> Since the return value of the existing methods on JQAjaxSetup was self already (i.e. the JQAjaxSetup subinstance), making this a transparant change is possible by converting it to add a corresponding function call decoration on the jQAjaxSetup instance, which returns self as well and allows to chain the messages in exactly the same way as they were done before. >> >> So the implementation of onComplete would be >> >> JQAjaxSetup>>onComplete: aJSObject >> self call: 'always' with: ajSObject asFunction >> >> Although this is a good thing for continuity, it's probably a bad idea to keep the old method names and rather make everyone use onFail:, onDone: and onAlways: instead (not sure about the last one though...). >> >> Thoughts? >> >> Johan >> >> On 18 Jul 2014, at 17:46, Esteban A. Maringolo <[hidden email]> wrote: >> >> > I was needing to handle an "error" callback for an xhr post, and found >> > there is no #onError: handler in JQPost. Went to jQuery website I >> > noticed most of the success/fail/complete methods in JQAjax hierarchy >> > are deprecated. >> > >> > Deprecation Notice >> > The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback >> > methods introduced in jQuery 1.5 aredeprecated as of jQuery 1.8. To >> > prepare your code for their eventual removal, use jqXHR.done(), >> > jqXHR.fail(), and jqXHR.always() instead. >> > >> > Is anybody updating JQuery wrapper for that? Or is there already a way >> > to deal with the new "promise" style way of chaining callbacks?. >> > >> > What I'm doing now is something like: >> > ((html jQuery post callback: [] value: ()) call: 'done' with: ("js >> > function")) call: 'fail' with: ("fail function") >> > >> > Regards! >> > >> > >> > Esteban A. Maringolo >> > _______________________________________________ >> > seaside-dev mailing list >> > [hidden email] >> > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev >> >> _______________________________________________ >> seaside-dev mailing list >> [hidden email] >> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev >> >> _______________________________________________ >> seaside-dev mailing list >> [hidden email] >> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev > > _______________________________________________ > seaside-dev mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev seaside-dev mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev |
Free forum by Nabble | Edit this page |