Michael,
In my API docs, it lists 3 parameters for the Bus.subscribe and
Bus.unsubscribe methods...
subscribe(String message, Function subscriber, Object context)
unsubscribe(String message, Function subscriber, Object context)
where the 3rd parameter is probably going to be "this" and appears to be
required per the API docs.
When I used all three parameters in my Playground for both subscribe and
unsubscribe, the error went away and both the subscibe and unsubscribe
work correctly. I moved the dispatch statement around to test the
functionality, and it only worked when placed between the subscribe and
unsubscribe calls.
> var messageBus = qx.event.message.Bus.getInstance();
>
> var message = new qx.event.message.Message("TEST");
>
>
>
> var myfunction = function() {
>
> alert("Here I am");
>
> }
>
>
>
> messageBus.subscribe("TEST", myfunction, this);
>
> // messageBus.unsubscribe("TEST");
> messageBus.unsubscribe("TEST", myfunction, this);
>
> messageBus.dispatch(message);
>
HTH,
Gene
On Wed, 2009-06-10 at 20:11 +0200, Michael Helwig wrote:
> Hi,
>
> how can I unsubscribe a function from a message bus
> (qx.event.message.Bus)?
>
> Calling messageBus.unsubscribe("MESSAGE_TEXT") yields an error
> ("sub[msgName] is null")
> Running the following in the Playground app also yields an error:
>
> [CODE]
> var messageBus = qx.event.message.Bus.getInstance();
> var message = new qx.event.message.Message("TEST");
>
> var myfunction = function() {
> alert("Here I am");
> }
>
> messageBus.subscribe("TEST", myfunction);
> messageBus.unsubscribe("TEST");
> [/CODE]
>
> Error:
> playground.Application[p]: TypeError: k[l] is null
>
> The combinations
> [CODE]
> messageBus.unsubscribe("TEST", myfunction);
> //OR
> messageBus.unsubscribe(myfunction);
> [/CODE]
> have no effect, the function gets called if the message is dispatched
> anyway.
>
> Am I doing something wrong or is this a bug?
>
> Greetings,
>
> Michael
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel