W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2005

[whatwg] event-source prototype and questions

From: Mike Dierken <mdierken@hotmail.com>
Date: Tue, 25 Oct 2005 22:03:19 -0700
Message-ID: <BAY101-DAV17626ACAD327D0DD935DA5D8690@phx.gbl>
I've put together a quick prototype to experiment with the event-source
design implications based on the WHAT-WG Web App spec here:
http://www.searchalert.net/dierken/eventsource/

This does not follow exactly the WebApp spec - rather, I'm making
suggestions about alternate approaches. 
These are the points I'd like to start a discussion about:
    * What markup is used within a page?
    * How are incoming messages routed to script handlers?
    * What javascript is used to receive messages?
    * What event stream format is used?
    * How are resources/URIs used?

This experiment/prototype is a simple bit of javascript that fetches a set
of messages and dispatches them to handlers within the page.
I'd be very happy if some folks could take a look at the comments and
questions on that page as well as the source of the prototype.

Also - one thing I couldn't figure out how to do with the javascript protype
was to dispatch to a javascript function and have that function access an
object by name without having to declare that object as a parameter to that
method.

For example:
I'd like to be able to write this:

<script>
function handleStocks()
{
	alert(msg.content);
}
</script>
<div event-src="http://example.org/stock-stream" onMessage="handleStocks()"
/>

But instead I had to write this:

<script>
function handleStocks(msg)
{
	alert(msg.content);
}
</script>
<div event-src="http://example.org/stock-stream"
onMessage="handleStocks(msg)" />

I tried using closures in several different ways and couldn't get it to
work. Any help would be appreciated - not necessarily to make the prototype
better, but just for my own education.
Received on Tuesday, 25 October 2005 22:03:19 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:43 UTC