Last active
August 29, 2015 13:58
-
-
Save garciamax/10231455 to your computer and use it in GitHub Desktop.
Plugin Starter
This file contains 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( $ ) {//my scope | |
var _obj = {},//container for plugin | |
_appName = 'MYDEFAULTPLUGINNAME';//will be visible in global scope, use unique name | |
_obj[_appName] = window[_appName] = new function(){//exposing to global scope | |
var _ = {//private methods | |
defaults:{}, | |
settings:{}, | |
l:function(severity, message) { | |
var _args = Array.prototype.slice.apply(arguments); | |
console[severity](_appName + ' :: ' + _args.slice(1, 2), _args.slice(2)); | |
} | |
}; | |
return {//public methods | |
init:function(settings){ | |
_.settings = $.extend(_.defaults,settings||{}); | |
_.l('log','init') | |
} | |
} | |
}; | |
_obj[_appName].init();//tada | |
})( jQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment