Skip to content

Instantly share code, notes, and snippets.

@itzg
Created October 28, 2012 02:43
Show Gist options
  • Save itzg/3967247 to your computer and use it in GitHub Desktop.
Save itzg/3967247 to your computer and use it in GitHub Desktop.
In JS constructor accept an optional 'options' object
var layout = {
Box: function(container, options) {
$.extend(this, {
vertical: false
}, options);
};
// HOWEVER, for Eclipse to discover the fields of Box, this approach is
// needed
var layout = {
Box: function(container, options) {
this.vertical = true;
this.gooClass = "gooey";
$.extend(this, options);
this.container = $(container);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment