Created
July 20, 2012 14:14
-
-
Save jshirley/3150949 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // When you define your module, you specify a function to run when it's being added in. | |
| // This includes a `Y` object: | |
| YUI.add('myModule', function(Y) { | |
| Y.Foo = function() { alert("Foo"); }; | |
| }); | |
| // When you *use* your module, you declare a similar function that gets a `Y` object passed in. | |
| YUI().use('myModule', function(Y) { | |
| Y.Foo = function() { alert("Bar"); }; | |
| }); | |
| YUI().use('myModule', function(Y) { | |
| Y.Foo(); // Will alert Foo, since you didn't modify anything in this namespace | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment