Created
November 22, 2013 16:04
-
-
Save gavinblair/7602291 to your computer and use it in GitHub Desktop.
Pattern for creating a JavaScript plugin, from http://codereview.stackexchange.com/a/21147
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
(function(ns){ | |
//private scoping | |
var privVar = '...'; | |
function priv(){...} | |
//expose a function | |
ns.myFunc = function(){...}; | |
}(this.myLib = this.myLib || {})); | |
//using the exposed myFunc | |
myLib.myFunc(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment