Created
April 26, 2013 09:29
-
-
Save zolitch/5466049 to your computer and use it in GitHub Desktop.
UMD module skeleton
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
/*jshint laxcomma : true */ | |
var BaseModuleConstructor | |
, NewClass = require('./newclass') | |
, _newClassInstance | |
, $ = $ || window.jQuery | |
; | |
BaseModuleConstructor = function BaseModuleConstructor( element, template ) | |
{ | |
var BaseModuleConstructor | |
, _element = $(element) | |
; | |
BaseModuleConstructor = function BaseModuleConstructor() | |
{ | |
//Initiation in here | |
_newClassInstance = new NewClass(); | |
}; | |
BaseModuleConstructor.prototype.method = function( data ) | |
{ | |
var blah; | |
//blah method stuff in here | |
}; | |
// getter setter to expose public variables that cannot be over written | |
Object.defineProperties(BaseModuleConstructor.prototype, { | |
'newClassInstance' : { | |
get : function() { | |
return _newClassInstance; | |
} | |
} | |
}); | |
function privateFunction( shitPassedIn ) | |
{ | |
console.log('shitPassedIn: ' + shitPassedIn); | |
} | |
return new BaseModuleConstructor(); | |
}; | |
//Public method not on prototype | |
BaseModuleConstructor.attach = function( element, shitPassedIn ) | |
{ | |
var tmpl | |
, blah = element | |
; | |
privateFunction.call(this, shitPassedIn); | |
}; | |
BaseModuleConstructor.Events = events = { | |
LOADED : 'loaded' | |
}; | |
module.exports = BaseModuleConstructor; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment