[Bese-devel] Re: forcing a client refresh
Marco Baringer
mb at bese.it
Fri May 26 11:07:23 UTC 2006
hbabcockos1 at mac.com writes:
> Another more useful refresh option, as I slowly learn more about ucw.
> It works with functions but not actions, it isn't clear to me why
> this is so.
>
> (defun timed-function-call (delay-in-ms function argument)
> (let ((href (concatenate 'string "location.href='"
> (action-href (lambda () (funcall function argument)))
> "'")))
> (<ucw:script `(setf window.onload
> (set-timeout ,href ,delay-in-ms)))))
an 'action' is a cc method (something defined with defmethod/cc
(defaction is a wrapper around defmethod/cc)). cc methods, when called
normally, return another function, which must be called again until a
DONE tag is thrown. the with-call/cc macro known this and handles it
properly, you'll notice that the <ucw tags (see
src/yaclml/ucw-tags.lisp) all use action-href like this:
`(action-href (lambda () (with-call/cc ,action)))
which is the only thing your code is missing:
(defun timed-function-call (delay-in-ms function argument)
(let ((href (concatenate 'string "location.href='"
(action-href (lambda ()
(with-call/cc
(funcall function argument))))
"'")))
(<ucw:script `(setf window.onload
(set-timeout ,href ,delay-in-ms)))))
now you can pass an action to timed-function-call, with-call/cc knows
how to handle normal (non /cc) functions as well so this change should
add functionatily while still allowing you to use it as before.
hth.
--
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
-Leonard Cohen
More information about the bese-devel
mailing list