Created
October 10, 2012 08:52
-
-
Save keriati/3864204 to your computer and use it in GitHub Desktop.
Javascript Objects
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 () { | |
var NS = NS || {}; | |
NS.SomeObject = (function () { | |
var defaults = { | |
a: "A" | |
} | |
function Constr(options) { | |
this.options = options; | |
this.foo = "bar"; | |
// do stuff | |
} | |
function _priv() { | |
// do private stuff | |
} | |
function foo() { | |
// do foo | |
} | |
function bar() { | |
// do bar | |
} | |
Constr.prototype = { | |
foo: foo, | |
bar: bar, | |
}; | |
return Constr; | |
})(); | |
window.NS = NS; | |
})(); | |
(function() { | |
var myObject = new NS.SomeObject({b: "b"}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment