This is just a quick bootstrap page for now.
To use LivePage, subclass or instantiate LivePage
instead of Page
. Then, in your HTML template, include
the following HTML fragment somewhere towards the bottom of the page:
<span view="webConduitGlue" />
Then, Event handlers can forward client-side JavaScript events to the Server, and you can send JavaScript to the browser after a page has already loaded. Example:
class Foo(page.LivePage): template = ('<html><body>' 'Nothing here!<span view="webConduitGlue" />' '</body></html>') def setUp(self, request): global currentPage # don't save this in a global but somewhere your code can get # to it later currentPage = request.getSession(interfaces.IWovenLivePage) # then later, in response to some server-side event def fooHappened(): global currentPage currentPage.sendScript("alert('hello, world!')")