npm.io
0.1.2 • Published 9 years ago

dc-cursor

Licence
ISC
Version
0.1.2
Deps
3
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

dc-cursor

WIP

An immutable data cursor implementation.

Quick start:

import { initCursor } from 'dc-cursor';

// create cursor instance
let onModelUpdate = function(newModel) {
  console.log('model updated, new value is:');
  console.log( newModel.$val() );
  model = newModel;
};

let model = initCursor([1, 2, 3], onModelUpdate);

// get value
console.log( model[0].$val() );
// => 1

// set value
model[0].$set('a');
// => model updated, new value is:
// => ['a', 2, 3]