Skip to content

Instantly share code, notes, and snippets.

@unknownuser88
Created January 6, 2014 15:49
Show Gist options
  • Save unknownuser88/8284752 to your computer and use it in GitHub Desktop.
Save unknownuser88/8284752 to your computer and use it in GitHub Desktop.
my namespace template
;var d = {
author: 'David',
//variables available to whole of namespace
someIds: [],
options: {
width: 400,
height: 300,
title: 'title'
},
init: function($, opts) {
if (typeof opts != 'undefined') {
$.extend(this.options, opts);
}
$(function() {
d.functionone();
d.functiontwo();
// preload the CSS background
preloadImage = new Image();
// preloadImage.src = "https://www.google.am/images/srpr/logo4w.png";
});
},
functionone: function() {
console.log(this.options.width);
},
functiontwo: function() {
//code
}
}
d.init(jQuery, {
width: 500
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment