2.0.1 • Published 9 years ago

observ-grid-stack v2.0.1

Weekly downloads
8
License
ISC
Repository
github
Last release
9 years ago

observ-grid-stack

Observe stacked array-grids (or observ-grid) of identical shape, falling back to grid below on coordinate value null.

Install via npm

$ npm install observ-grid-stack

API

var ObservGridStack = require('observ-grid-stack')

var gridStack = ObservGridStack([startStack])

Create an observable grid stack. Optionally specify an array of array-grids (or observ-grid) as startStack.

var remove = gridStack.push(grid)

Push an array-grid onto the stack. Non-null coordinate values will override the value directly below in the stack.

var removedGrid = gridStack.pop()

gridStack.get(row, col)

Resolve coordinates against flattened stack.

gridStack.index(row, col)

gridStack.lookup(row, col)

gridStack.coordsAt(row, col)

gridStack.update()

Simulates a nextTick, and computes immediately if any changes.

Observable Attributes

gridStack

Returns an array-grid based on flattened stack. Notifies on all changes to stack on nextTick.

gridStack.stack (ObservArray)

Modify directly or use gridStack.push(grid) and gridStack.pop().