Last active
October 13, 2015 07:07
-
-
Save cmalven/4157659 to your computer and use it in GitHub Desktop.
Basic Javascript Object
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 MyObject(options) { | |
/***************************************** | |
/* PRIVATE VARS | |
/****************************************/ | |
var self = { | |
} | |
/***************************************** | |
/* PUBLIC VARS | |
/****************************************/ | |
self.defaults = { | |
} | |
/***************************************** | |
/* PRIVATE METHODS | |
/****************************************/ | |
var init = function() { | |
updateSettings(); | |
addEventListeners(); | |
} | |
var updateSettings = function() { | |
if (typeof options == 'object') { | |
self.settings = $.extend(self.defaults, options); | |
} else { | |
self.settings = self.defaults; | |
} | |
} | |
var addEventListeners = function() { | |
} | |
/***************************************** | |
/* PUBLIC METHODS | |
/****************************************/ | |
self.myFunction = function() { | |
} | |
// Initiate | |
init(); | |
// Return the Object | |
return self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment