Created
June 2, 2011 02:37
-
-
Save cjheath/1003830 to your computer and use it in GitHub Desktop.
Style for Javascript constructor
This file contains hidden or 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
| 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