Skip to content

Instantly share code, notes, and snippets.

@ryanmarshall
Last active August 25, 2015 22:25
Show Gist options
  • Save ryanmarshall/c623f5e4d74f89734566 to your computer and use it in GitHub Desktop.
Save ryanmarshall/c623f5e4d74f89734566 to your computer and use it in GitHub Desktop.
var Generator = function(options) {
this.init = function() {
console.log('init')
this.runSomeSetup();
};
this.runSomeSetup = function() {
console.log('setup');
}
this.init();
};
if (generator_options)
new Generator(generator_options);
@dfltr
Copy link

dfltr commented Aug 25, 2015

var Generator = function(options) {
    //options var will be available anywhere from here on down into inner funcs

    this.init = function() {
        //like here!
        console.log(options);
        this.runSomeSetup();
    };

    this.runSomeSetup = function() {
        console.log('setup');
    }

    this.init();
};
if (generator_options)
    new Generator(generator_options);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment