2020-08-05 18:38:55 +02:00
|
|
|
/*
|
|
|
|
Copyright 2020 Bruno Windels <bruno@windels.cloud>
|
2020-10-08 16:14:59 +02:00
|
|
|
Copyright 2020 The Matrix.org Foundation C.I.C.
|
2020-08-05 18:38:55 +02:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2019-06-16 10:52:02 +02:00
|
|
|
import {tag} from "../general/html.js";
|
2019-06-15 17:50:15 +02:00
|
|
|
|
2020-10-08 16:14:59 +02:00
|
|
|
export class StaticView {
|
2020-10-19 09:59:56 +02:00
|
|
|
constructor(value, render = undefined) {
|
|
|
|
if (typeof value === "function" && !render) {
|
|
|
|
render = value;
|
|
|
|
value = null;
|
|
|
|
}
|
|
|
|
this._root = render ? render(tag, value) : this.render(tag, value);
|
2019-06-15 17:50:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
mount() {
|
|
|
|
return this._root;
|
|
|
|
}
|
|
|
|
|
|
|
|
root() {
|
|
|
|
return this._root;
|
|
|
|
}
|
|
|
|
|
|
|
|
unmount() {}
|
|
|
|
update() {}
|
|
|
|
}
|