support render method and value in StaticView

This commit is contained in:
Bruno Windels 2020-10-19 09:59:56 +02:00
parent 41d624a1ae
commit efe6956a79

View File

@ -18,8 +18,12 @@ limitations under the License.
import {tag} from "../general/html.js";
export class StaticView {
constructor(render) {
this._root = render(tag);
constructor(value, render = undefined) {
if (typeof value === "function" && !render) {
render = value;
value = null;
}
this._root = render ? render(tag, value) : this.render(tag, value);
}
mount() {