Skip to content

viewFactory + tree shaking

Compare
Choose a tag to compare
@pakastin pakastin released this 13 Dec 11:01
· 29 commits to master since this release
  • 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>