[Bese-devel] Re: forcing a client refresh

hbabcockos1 at mac.com hbabcockos1 at mac.com
Thu Apr 27 18:31:06 UTC 2006


 
On Thursday, April 27, 2006, at 03:27AM, Marco Baringer <mb at bese.it> wrote:

>hbabcockos1 at mac.com writes:
>
>> past I might have done this with a javascript timer. Is there a
>> better way to do this using ucw? Or, how would you do this using
>> ucw?
>
>there's nothing ucw-specific that can help you with this (though all
>the usual javascript technicques are applicable).

Ok, thanks. After a some fiddling I was able to figure out how to do this
using parenscript (that capitilization is tricky stuff...) to reload the
current page. I'm curious however whether it is possible to call an action.
It seems that to me that <ucw:a :action .., among other things, creates
a URL that I could in theory embed in the page for the javascript
function to call. But maybe this is pointless?

best,
-Hazen

Just in case this is helpful to anybody, this macro (if added to a
component's render method) will cause the page to be reloaded,
triggering another call to the render method.

(defmacro timed-self-refresh (delay-in-ms)
  `(<:script :type "text/javascript"
    (<:as-is
     (js:js
      (defun init-timed-refresh-call ()
	(set-timeout "doTimedRefreshCall()" ,delay-in-ms))
      (defun do-timed-refresh-call ()
	(window.location.reload))
      (setf window.onload init-timed-refresh-call)))))




More information about the bese-devel mailing list