addEventListener on my own extension?

Simon <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <7b0152c0-df31-4c75-ba92-ad1fcb94e143@r15g2000prh.googlegroups.com>
Hello,

I wrote a multicast-xml-receiver extension. The received xml-data will
be handled by javascript in a webpage. So my idea was to make
something like this:
--
obj = Components.classes[cid].createInstance();
obj = obj.QueryInterface(Components.interfaces.nsIXMLMulticastSocket);
obj.join("228.5.6.7", 6789);

obj.addEventListener("dataEvent", onData, false);

....

function onData(ev) { alert(ev.getData()) } // alert the received
string

--

My question is how can i implement this?
I read that i have to implement the nsDOMEventTarget. But where do i
register the "onData" function? Can i reuse some existing code?

Thanks a lot!
Regards
Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.