Releases: finom/defi
Releases · finom/defi
defi-react
Add "define" option for defi.set
The option allows to make a property to be listen-able by "change" event.
const obj = {};
defi.on('change', ({ key }) => console.log(`${key} is changed`));
defi.set(obj, 'x', 1, { define: true }); // logs "x is changed"
defi.x = 2; // also logs "x is changed"
v1.0.0
BREAKING CHANGE: The library doesn't support space-delimited event names any more (use an array instead) but does support Symbol
as an event name. The change covers on
, off
and trigger
methods.
Before:
// a single event
on(obj, 'foo', handler);
// a list of events
on(obj, 'foo bar baz', handler);
After
// a single event
on(obj, 'foo', handler);
// a single event with a symbolic name
on(obj, Symbol.for('foo'), handler);
// a list of events
const foo = Symbol('foo');
on(obj, [foo, Symbol.for('bar'), 'baz'], handler);