Skip to content

Instantly share code, notes, and snippets.

@feesta
Created May 23, 2013 01:05
Show Gist options
  • Save feesta/5632117 to your computer and use it in GitHub Desktop.
Save feesta/5632117 to your computer and use it in GitHub Desktop.
Template for a namespaced jQuery library with it's own classes.
// DummyConsole.js
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});
if (typeof MINE === "undefined") MINE = {};
var options = {};
jQuery(function() {
M = new MINE.MyLibrary(options);
});
(function($) {
var MyLibrary = function(options) {
this.options = $.extend(MyLibrary.defaults, options);
this.init();
};
MINE.MyLibrary = MyLibrary;
MyLibrary.defaults = {
value1: 1,
value2: 2
};
MyLibrary.prototype = {
options: null,
defaultsval:3,
init: function() {
var self = this;
},
method1: function() {
}
};
MyLibrary.Utils = {
};
MyLibrary.OtherClass = function(options) {
this.init();
};
MyLibrary.OtherClass.prototype = {
othervalue: null,
init: function() {
},
othermethod: function() {
}
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment