Populate an observable array from node descriptors.
Install via npm
$ npm install observ-node-array
var ObservNodeArray = require('observ-node-array')
options:
- nodes: An object containing a lookup of observ-* constructors.
- nodeKey: (defaults to
'node'
) They key on the descriptor to use for finding constructor innodes
lookup.
Gets an array of descriptors as set
or added using push
, insert
(recursive obs()
).
listener
is called every time the node array is updated.
Hydrate descriptors based on nodeKey
specified using the constructors in options.nodes
. If a node already exists at the same index, it will be updated to matched (using node.set
), otherwise replaced or deleted (calling node.destroy
).
var lookup = require('observ-node-array/lookup')
var map = require('observ-node-array/map')
var concat = require('observ-node-array/concat')
var merge = require('observ-node-array/merge')
var first = require('observ-node-array/first')
var ObservNode = require('observ-node-array/single')
var ObservVarhash = require('observ-node-array/varhash')
var watch = require('observ-node-array/watch')
watch(nodeArray, function(item){
return item(function onChange(){
})
})