Skip to content

Instantly share code, notes, and snippets.

@bfgeek
Created June 30, 2016 21:31
Show Gist options
  • Save bfgeek/a4ca5e42f7e379c2b4009ca71e6ae296 to your computer and use it in GitHub Desktop.
Save bfgeek/a4ca5e42f7e379c2b4009ca71e6ae296 to your computer and use it in GitHub Desktop.
registerLayout('my-grid-layout', class {
static inputProperties = [/* etc */];
constructor() {
this.grid = []; // Place items on a cached grid so don't have to recompute each layout call.
}
addRemoveChildren(addRemoveList) {
// Rebuild grid now, only occurs when child list changes.
for (let i = 0; i < addRemoveList.length; i++) {
this.grid[m][n] = child;
}
}
layout(constraintSpace, breakToken, etc) {
// Actually perform layout on the grid for the given constraint space.
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment