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) {}
}
