My sample code has an error in it. Make this small change and you should
have no more problems, at least I am getting my data now:
from: qx.event.message.Message('transport-update'), s);
to: qx.event.message.Message('transport-update', s));
Jim
On 9/7/07, frederic <[EMAIL PROTECTED]> wrote:
>
>
> Hello,
> The following code doesn't work :
>
> *** test.txt ***
> Hello world
>
> *** Application.js ***
> var req = new qx.io.remote.Request('test.txt');
> req.addEventListener('completed', function(e){
> s = e.getData().getContent();
> this.debug("s="+s);
> qx.event.message.Bus.dispatch(new
> qx.event.message.Message('transport-update'), s);
> });
> req.send();
>
> qx.event.message.Bus.subscribe('transport-update',
> function(message){
> var data = message.getData();
> window.setTimeout(function(x){
> alert(data)
> },0)
> })
>
> The alert box print "null" (tested on FF2.0.6, no error in Firebug) and
> not
> "Hello world".
> Tested on latest trunk and 0.7.1.
>
> What's wrong ?
>
> frederic
>
>
>
>
>
>
> bibliograph wrote:
> >
> > Jim, I think Derrell is right here - messages are disposed after all
> > subscribers have been notified.
> >
> > Christian
> >
> > Derrell Lipman schrieb:
> >>
> >>
> >> On 9/5/07, *Jim Hunter* <[EMAIL PROTECTED]
> >> <mailto:[EMAIL PROTECTED]>> wrote:
> >>
> >> Christian,
> >>
> >> I was excited to see this bit of information so I tried out some
> >> tests to see what I could do with messages and I am not able to
> >> pass data like your sample shows. When I do the exact same thing
> >> as you have, the getData() is null. Is there a typo in your code
> >> or what might I be doing wrong? Here is a quick sample of what I
> >> tried:
> >>
> >> qx.event.message.Bus.subscribe('transport-update',
> >> function(message){
> >> window.setTimeout(function(x){
> >> alert(message.getData())
> >> },0)
> >> }
> >> )
> >>
> >>
> >> var req = new qx.io.remote.Request('test.txt');
> >> req.addEventListener('completed', function(e){
> >> s = e.getData().getContent();
> >> qx.event.message.Bus.dispatch(new
> >> qx.event.message.Message('transport-update'), s);
> >> });
> >> req.send();
> >>
> >> When the file is loaded it dispatches the 'transport-update'
> >> message and when the alert fires in the message.Bus event, it says
> >> 'null' when it should have the info stored in s. If I pass in true
> >> like you did, I get the same results, null.
> >>
> >> Any thoughts?
> >>
> >>
> >> Jim, without doing any experimenting, it looks to me like the event
> >> may no longer exist when your timeout eventually fires. You might try
> >> saving it in a local variable (with a closure) like this to see if it
> >> makes any difference:
> >>
> >> qx.event.message.Bus.subscribe('transport-update',
> >> function(message){
> >> var data = message.getData();
> >> window.setTimeout(function(x){
> >> alert(data)
> >> },0)
> >> }
> >> )
> >>
> >> Derrell
> >>
> >>
> ------------------------------------------------------------------------
> >>
> >>
> -------------------------------------------------------------------------
> >> This SF.net email is sponsored by: Splunk Inc.
> >> Still grepping through log files to find problems? Stop.
> >> Now Search log events and configuration files using AJAX and a browser.
> >> Download your FREE copy of Splunk now >> http://get.splunk.com/
> >>
> ------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> qooxdoo-devel mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >>
> >
> >
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > qooxdoo-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Sending-a-message-tf3922867.html#a12556621
> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel