Created
January 8, 2010 20:52
-
-
Save cowboy/272407 to your computer and use it in GitHub Desktop.
View revisions from oldest -> newest
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
// Creating a plugin with $.myNS.public_method1() and $.myNS.public_method2() methods, a few different ways. | |
(function($){ | |
var private_var, | |
myNS = $.myNS = {}, | |
public_method2; | |
myNS.public_method1 = function(){ | |
private_method(); | |
}; | |
myNS.public_method2 = public_method2 = function(){ | |
return private_var; | |
}; | |
function private_method() { | |
public_method2(); | |
} | |
})(jQuery); | |
// 134 bytes compressed | |
// (function(b){var d,e=b.myNS={},a;e.public_method1=function(){c()};e.public_method2=a=function(){return d};function c(){a()}})(jQuery); | |
// | |
// private references to internally-used public methods further helps minification |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment