[whatwg] event-source prototype and questions

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