Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Created August 13, 2016 14:13
Show Gist options
  • Save AJFaraday/56e258000227b4d46003ec9cb304e45c to your computer and use it in GitHub Desktop.
Save AJFaraday/56e258000227b4d46003ec9cb304e45c to your computer and use it in GitHub Desktop.
// I'm trying to hide most of the JS class and provide a public API in this style.
GridGame.classes.board = function () {
this.rows = [['1', '2'], ['3', '4']];
this.draw_row = function (row_index, row_tiles) {
//...
};
return {
draw: function () {
GridGame.table.empty();
$.each(this.rows, this.draw_row);
}
}
};
// It's not working because within the returned object, 'this.rows' and 'this.draw_row' are undefined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment