[Seaside] Non-blocking jQuery load

Johan Brichau johan at inceptive.be
Sat Nov 21 08:14:49 UTC 2015

Hi Joachim,

I’m not really sure what “timeout” you are referring to, but your reply makes me think of an issue (see below).
The timeout method I used in my code snippet corresponds to JavaScript’s setTimeout function wrapped around the ajax request. So, in that sense, any JS expression supports that.

BUT, an issue regarding the #timeout: message pops to my mind:

There are two unrelated implementations of the #timeout: message. The one on (JSObject>>timeout:) is to wrap a JS statement in a setTimeout function, the other one on (JQAjaxSetup>>timeout:) is to set a timeout value for the ajax request. Unfortunately, the latter overrides the former. I suspect that the code I sent you hits that issue. You can solve it by sending "addDecoration: (JSTimeout duration: aDuration)” instead of #timeout:.

I got bitten by this before. I ignored it (working around it by using #addDecoration:). A colleague of mine got bitten just a couple of weeks ago. I think you got bitten too now.
I think I should no longer ignore this unpolymorphic override anymore :/ [1]

[1] https://github.com/SeasideSt/Seaside/issues/861 <https://github.com/SeasideSt/Seaside/issues/861>

> On 20 Nov 2015, at 10:07, jtuchel <jtuchel at objektfabrik.de> wrote:
> Johan,
> thanks a lot for this idea and code draft. It is of course exactly what I need. 
> Given that we use that background process thing at another place (show a progress dialog for a long running process), it is sad but trrue I didn't think of the same technique for this purpose. But of course this is the perfect thing to do. Thus the Ajax's will be short running and the browser won't wait for the data. Definitely worth it.
> Once again: thanks a lot for your guidance and help! I still hope one day I can give something back.
> Maybe a drink in Prague at ESUG 2016 counts as a first attempt? ;-)
> Joachim
> Am 20.11.15 um 09:52 schrieb Johan Brichau-2 [via Smalltalk]:
>>> On 20 Nov 2015, at 09:57, Johan Brichau <[hidden email] <x-msg://11/user/SendEmail.jtp?type=node&node=4862164&i=0>> wrote:
>>> This perfectly fits your decoration implementation. Something along these lines (disclaimer: untested code written in email client :) :
>> The code I sent before will poll a bit too quickly :) I forgot to add a wait on the client:
>> 	replaced
>> 		ifTrue: [div with: [self renderNextOn: html]]
>> 		ifFalse: [
>> 			html document addLoadScript: (self loadScriptOn: html).
>> 			div with: [
>> 				html image src: someSpinnerImage
>> 				html space; text: self message]]
>> 	loadScriptOn: html
>> 		(html jQuery: self idSelector) load html: [:r |
>> 					self isDataReady
>> 						ifTrue:[ replaced := true.
>> 							    self renderNextOn: html]
>> 						ifFalse: [ r addLoadScript: ((self loadScriptOn: r) timeout: 1000) ]).
>> _______________________________________________ 
>> seaside mailing list 
>> [hidden email] <x-msg://11/user/SendEmail.jtp?type=node&node=4862164&i=1> 
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
>> If you reply to this email, your message will be added to the discussion below:
>> http://forum.world.st/Non-blocking-jQuery-load-tp4861881p4862164.html <http://forum.world.st/Non-blocking-jQuery-load-tp4861881p4862164.html>
>> To unsubscribe from Non-blocking jQuery load, click here <applewebdata://8C1AE71D-0F22-46F4-A2E1-75D0AB4D1D73>.
>> NAML <http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> -- 
> -----------------------------------------------------------------------
> Objektfabrik Joachim Tuchel          [hidden email] <x-msg://11/user/SendEmail.jtp?type=node&node=4862167&i=0>
> Fliederweg 1                         http://www.objektfabrik.de <http://www.objektfabrik.de/>
> D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com <http://joachimtuchel.wordpress.com/>
> Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1
> View this message in context: Re: Non-blocking jQuery load <http://forum.world.st/Non-blocking-jQuery-load-tp4861881p4862167.html>
> Sent from the Seaside General mailing list archive <http://forum.world.st/Seaside-General-f86180.html> at Nabble.com <http://nabble.com/>.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org <mailto:seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside <http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20151121/3ea98773/attachment-0001.htm

More information about the seaside mailing list