index.vwf.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { h, text,patch } from "$host/lib/ui/superfine.js"
  2. class UserView {
  3. constructor(view) {
  4. this.view = view;
  5. this.init();
  6. }
  7. init() {
  8. let self = this;
  9. vwf_view.initializedNode = function (nodeID, childID, childExtendsID, childImplementsIDs,
  10. childSource, childType, childIndex, childName) {
  11. if (childID == vwf_view.kernel.application()) {
  12. let el = document.createElement("pure");
  13. el.setAttribute("id", childID);
  14. document.querySelector("body").appendChild(el);
  15. }
  16. }
  17. vwf_view.satProperty = function (nodeID, propertyName, propertyValue) {
  18. if (propertyValue === undefined || propertyValue == null) {
  19. return;
  20. }
  21. let el = document.querySelector("[id='" + nodeID + "']");
  22. if (!el)
  23. return
  24. if (propertyName == 'pure') {
  25. self.updatePure(propertyValue, el)
  26. }
  27. }
  28. }
  29. updatePure(state, el) {
  30. patch(
  31. el, h("pure", {style: "position: absolute; top: 100px;" }, [
  32. h("h1", {}, text(state))
  33. ]));
  34. }
  35. }
  36. export {UserView as default}