@action-land/component
Version:
Basic interface for a component
28 lines (27 loc) • 619 B
JavaScript
;
/**
* Created by tushar on 08/08/18
*/
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Component interface.
*/
class Component {
constructor(init, update, command, view) {
this.init = init;
this.update = update;
this.command = command;
this.view = view;
}
/**
* @deprecated Use Component.lift() instead
*/
map(fn) {
return this.lift(fn);
}
lift(fn) {
return fn(this);
}
}
exports.Component = Component;
exports.COM = (init, update, command, view) => new Component(init, update, command, view);