Skip to content

Instantly share code, notes, and snippets.

@cjheath
Created June 2, 2011 02:37
Show Gist options
  • Select an option

  • Save cjheath/1003830 to your computer and use it in GitHub Desktop.

Select an option

Save cjheath/1003830 to your computer and use it in GitHub Desktop.
Style for Javascript constructor
Thing = function() {
var thing = {... some initial content...};
(function(a, b, options) {
var local1, local2; // forward-declare private methods
this.method = function() {
... local1(a,b); ...
};
local1 = function(c, d) {
...
};
return this;
}).apply(thing, arguments);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment