Created
August 17, 2013 04:03
-
-
Save edwardhotchkiss/6255188 to your computer and use it in GitHub Desktop.
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
// standard encapsulating self executing closure | |
(function(root) { | |
'use strict'; | |
/* ---- private ---- */ | |
/** | |
* @private _hasConsole | |
*/ | |
var _hasConsole = (typeof(window.console) === 'object'); | |
/** | |
* @private _log | |
* @description check for console, log | |
* @param {String} args console.log arguments | |
*/ | |
function _log(msg) { | |
if (!_hasConsole) { | |
return; | |
} | |
var log, args; | |
args = Array.prototype.slice.call(arguments); | |
log = Function.prototype.bind.call(console.log, console); | |
log.apply(console, args); | |
} | |
/** | |
* @constructor Skeleton | |
*/ | |
var Skeleton = function Skeleton(params) { | |
params = params || {}; | |
this.name = params.name || 'default'; | |
this.initialize(); | |
} | |
/* ---- instance prototypes ---- */ | |
Skeleton.prototype = { | |
/** | |
* @method initialize | |
* @description called on instantiation | |
*/ | |
initialize: function() { | |
_log('this skeleton\'s name is "%s"', this.name); | |
} | |
}; | |
// attach to "root" => (window) | |
root.Skeleton = Skeleton; | |
// "root" | |
}(window)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment