ivi
Version:
Lightweight Embeddable Web UI Library.
37 lines • 1.07 kB
JavaScript
import { defineRoot, dirtyCheck, unmount, findDOMNode, update, } from "../index.js";
export class TestRoot {
_root;
_isDirty;
get root() { return this._root; }
get isDirty() { return this._isDirty; }
constructor() {
this._root = null;
this._isDirty = false;
}
findDOMNode() {
return findDOMNode(this._root);
}
update(v, forceUpdate) {
update(this._root, v, forceUpdate);
this._isDirty = false;
}
dirtyCheck(forceUpdate) {
dirtyCheck(this._root, forceUpdate);
this._isDirty = false;
}
dispose() {
unmount(this._root, true);
this._isDirty = false;
}
_invalidate() {
this._isDirty = true;
}
}
export const createRoot = (parentElement = document.body, nextNode = null) => {
const testRoot = new TestRoot();
const root = _createRoot(parentElement, nextNode, testRoot);
testRoot._root = root;
return testRoot;
};
const _createRoot = defineRoot((root, state) => { state._invalidate(); });
//# sourceMappingURL=index.js.map