Skip to content

Instantly share code, notes, and snippets.

@keriati
Created October 10, 2012 08:52
Show Gist options
  • Save keriati/3864204 to your computer and use it in GitHub Desktop.
Save keriati/3864204 to your computer and use it in GitHub Desktop.
Javascript Objects
(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