24 lines
439 B
TypeScript
24 lines
439 B
TypeScript
import m from 'mithril';
|
|
|
|
export abstract class Component {
|
|
abstract view(vnode: m.Vnode): m.Children;
|
|
|
|
constructor(vnode?: m.Vnode) {
|
|
|
|
}
|
|
|
|
oninit(vnode: m.Vnode) {}
|
|
|
|
oncreate(vnode: m.Vnode) {}
|
|
|
|
onbeforeupdate(newVnode: m.Vnode, oldVnode: m.Vnode) {
|
|
return true;
|
|
}
|
|
|
|
onupdate(vnode: m.Vnode) {}
|
|
|
|
onbeforeremove(vnode: m.Vnode): Promise<void> | void {}
|
|
|
|
onremove(vnode: m.Vnode) {}
|
|
}
|