Skip to content

Instantly share code, notes, and snippets.

Last active Dec 11, 2015
What would you like to do?
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
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment