[Seaside-dev] JQuery XHR methods

Esteban A. Maringolo emaringolo at gmail.com
Mon Jul 28 23:49:29 UTC 2014


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 <johan at inceptive.be>:

> 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 <emaringolo at gmail.com>
> 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
> > seaside-dev at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside-dev/attachments/20140728/3ede27b4/attachment-0001.htm


More information about the seaside-dev mailing list