Easy data manipulation to get, emit, set, compute and observe.
$ npm install gesco
Get the value stored in the path.
gesco.get('foo.bar');
Delete the value stored in the path. See silence.
gesco.delete('foo.bar');
Bubbles the value changes. See bubbles.
gesco.emit('foo.bar')
gesco.emit('foo', foo => {
foo.push('bar');
})
Since changing a property directly or using array methods won't bubble, this allows you to indicate to Gesco that there has been a change/transformation. Use callback
to perform operations like that.
Stores a value in the path. See silence.
gesco.set('foo', 'bar');
Observe the path and the descending paths.
gesco.observe('foo.bar', bar => {
console.log('bar has changed:', bar);
});
Compute the path and the descending paths.
gesco.compute('newBar', 'foo.bar', bar => bar.toUpperCase());
Links two different paths.
gesco.link('path1', 'path2');
This term refers to triggering the direct and indirect observers/computers of a path.
The methods set
, delete
and emit
bubble the value changes automatically when invoked.
This term refers to prevent bubbling the value changes.
When a value is changed, the change propagates to the path itself and its descendants. For example, changing foo
will trigger:
foo
foo.bar
foo.bar.quux
MIT © Isaac Ferreira zaclummys@gmail.com