Releases: redom/redom
Releases · redom/redom
dispatch
Added simple helper for creating bubbling CustomEvents (trigger events that bubble components upstream)
import { el, dispatch, mount } from 'redom';
class Component {
constructor () {
this.el = el('.component');
this.el.onclick = () => {
dispatch(this, { componentClicked: true });
};
}
}
const component = new Component();
mount(document.body, component);
document.body.addEventListener('redom', e => console.log(e.detail)); // { componentClicked: true }
component.el.onclick();
You can also define custom event name:
dispatch(this, { hello: 'RE:DOM' }, 'custom-event');
Also modernized and simplified tests with Teston
viewFactory + tree shaking
- Tree shaking finally enabled! (as npm module)
- viewFactory added:
import { list, viewFactory } from 'redom';
class A {
constructor () {
this.el = el('a');
}
update () {
...
}
}
class B {
constructor () {
this.el = el('b');
}
update () {
...
}
}
const items = list('items', viewFactory({ a: A, b: B }, 'type'), 'id');
items.update([{ id: 1, type: 'a' }, { id: 2, type: 'b' }]);
––>
<items>
<a></a>
<b></b>
</items>
Don't use DOM memoization
v3.28.0
Type issue fixed
Type issue fixed
Type issue fixed, thank you @flery and @joona!
v3.24.0
Added support for plain element and component instance children in Router and Place
Updated dependencies
- Especially Terser v4.0.0