3 ms·
And for me, both are unnecessary overcomplicated abstractions over mithril+js based classical MVC (not web-renamed one): class App { constructor() {
by wruza 5y ago
And for me, both are unnecessary overcomplicated abstractions over mithril+js based classical MVC (not web-renamed one):
class App {
constructor() {
this.message = 'Hello'
this.foo = new Foo
this.show_foo = true
}
bye() {
this.message = 'Bye'
this.show_foo = false
}
}
class AppView {
view({attrs:{app}}) {
const attrs = {
onclick: (e) => app.bye(),
}
return m('div.container', [
m('h1', attrs, 'Hello!'),
(app.show_foo
? m(FooView, {foo:app.foo}),
: null),
this.render_footer(app),
])
}
render_footer(app) {
return m(…)
}
}
window.app = new App
m.mount(document.all.root, {
view: () => m(AppView, {app}))
})