Hi, all.

One thing I did recently with the lazr-js upgrade was to convert all
local js in Launchpad to consistently use the LPS object initialized
in the base template.  This is an instance of YUI that has been passed
a few YUI config parameters.  We should never create a new YUI
instance in our templates.  Always reuse the LPS object.

Until now you might find something like this in a template:

YUI().use('base', 'node', function(Y) {
    // Do something
});

That should now be written:

LPS.use('base', 'node', function(Y) {
    // Do something
});

Please don't ever do YUI().use again.  It creates problems and subtle
issues that are hard to debug.  There should never be a case where you
need a use block before LPS is initialized.  If you do, you absolutely
must restructure your code.

I'll update the JavaScript style/reviewer wiki page with this info now, too.

Cheers,
deryck

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

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to