Create a gist now

Instantly share code, notes, and snippets.

Writing JS in object-literal style.
;(function(window, undefined) {
'use strict';
var SomeObj = function(opts) {
if (opts.whatever) this.isWhatever = true;
// do some constructor stuff
this.init(opts.thing);
};
SomeObj.prototype = {
FOO_CONST: '1337',
BAR_CONST: 'baz',
isWhatever: null,
otherInstanceProperty: null,
init: function(thing) {...},
_localFuncFoo: function() {...},
_localFuncBar: function() {...},
_localFuncBaz: function() {...},
};
window.My.App.Namespace.SomeObj = SomeObj;
}(window));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment