| Page 1 of 1 | [ 4 posts ] |
|
Hi,
I have some custom events bubbling between widgets in different modules (one YUI instance) but they only bubble if I add the following dummy bit of code into bindUI() of the firing widget: this.on("mycustomevent", function(e) { Y.log("HERE I AM"); } ); I guess the custom event thinks no-one is listening for it and so this.fire("mycustomevent") doesn't broadcast. I have listeners for the custom events in the event target modules but these only fire with the above dummy listener included in the module firing the event. I have followed the custom event documentation closely but nevertheless must have misunderstood something. Any ideas? Thanks Alex |
|
Please linik a full example. Bubbling and broadcasting are different in YUI, which are you doing? What YUI dependencies been included on the page?
|
|
Hi,
I am bubbling - as I understand it I should use 'broadcast' when the YUI instance or other YUI instances are the listeners. My app is within a local environment - I need to create a simplified test harness for this. I have included 'event', 'event-custom', 'event-custom-complex'. Do you think the problem I have relates to the 'exit' case referred to in this comment in event-target.js for the 'fire' method : * * If the custom event object hasn't been created, then the event hasn't * been published and it has no subscribers. For performance sake, we * immediate exit in this case. This means the event won't bubble, so * if the intention is that a bubble target be notified, the event must * be published on this object first. This comment(and code) suggests I do need to publish even if I am using the default configuration for custom events. This comment implies also that I must publish in the target object - not the firing object - but what if I have other targets? Is there a way to dump the custom event queue with a list of listeners? I will create test case and perhaps see where I am going wrong. Thanks Alex |
|
I have a small test case which demonstrates the problem I am having. I have obviously missed some basic thing.
The test is based on the yui3 custom event example and extends the eaxmple to include a new module (module1) with a custom widget which renders a slider. The slider 'slideEnd' event causes the widget to fire a custom event to be received by the Publisher object. The Publisher instance only receives this event if I explicitly *also* listen for the custom event in the widget that fired it. The link is: http://yui.alexlebek.co.uk/event-ce.html Any enlightening thoughts appreciated! Alex |
| Page 1 of 1 | [ 4 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group