← Back to team overview

launchpad-dev team mailing list archive

Re: YUI sandboxes, event propagation and global namespaces

 

Hi, Ian.

On Mon, Jan 30, 2012 at 10:55 PM, Ian Booth <ian.booth@xxxxxxxxxxxxx> wrote:
> It has no knowledge of who is interested in these updates. On the
> subscriber side, there exists on various pages code like:
>
> YUI().use('io-base', 'lp.ui', 'lp.client', function(Y) {
>
>    Y.on('lp:context:deb_version_template:changed', function(e) {
>        Y.lp.ui.update_field('#debian-version dd', e.new_value);
>    });
>    Y.on('lp:context:base_branch_link:changed', function(e) {
>        Y.lp.ui.update_field('#base-branch dd', e.new_value_html);
>    });
> });
>

In the example you give here, if the events are fired from lp.client,
this code should work, since you include lp.client in the use
statement.  The publisher doesn't have to know about the subscriber.
Only that the subscriber has to know about the module publishing the
events.  I'm not actually online and working yet, but when I am, I'll
take a closer look to see why this isn't working.

Cheers,
deryck

-- 
Deryck Hodge
https://launchpad.net/~deryck
http://www.devurandom.org/


References