commit: 61eb36c4daf25816ba64b5834f8ecb7d5db98220
parent b2077cbc345468b59c84739cdacccfbce8d74a5b
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Mon, 5 Mar 2018 14:45:59 +1300
Progress on Dom node
Diffstat:
4 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/scripts/graph.js b/scripts/graph.js
@@ -24,22 +24,20 @@ function graph()
])
Ø("view").mesh({x:18,y:0},[
- Ø("template").cast({x:5,y:2},TemplateNode),
- Ø("dom").cast({x:5,y:8},DomNode),
- Ø("header").cast({x:2,y:14},ElementNode),
- Ø("body").cast({x:5,y:14},ElementNode),
- Ø("footer").cast({x:8,y:14},ElementNode),
+ Ø("dom").cast({x:5,y:2},DomNode),
+ Ø("header").cast({x:2,y:8},ElementNode),
+ Ø("body").cast({x:5,y:8},ElementNode),
+ Ø("footer").cast({x:8,y:8},ElementNode),
])
Ø("router").syphon("database")
Ø("database").syphon(["recipes","ingredients","pages"])
- Ø("template").syphon("dom")
Ø("dom").syphon(["header","body","footer"])
+ Ø("dom").connect("print")
Ø("query").connect("router")
- Ø("router").connect("template")
- Ø("template").connect("print")
+ Ø("router").connect("dom")
Ø("query").bang()
}
diff --git a/scripts/nodes/dom.js b/scripts/nodes/dom.js
@@ -3,4 +3,31 @@ function DomNode(id,rect)
Node.call(this,id,rect);
this.glyph = NODE_GLYPHS.dom
+
+ this.el = document.createElement("yu")
+ this.is_installed = false;
+
+ this.receive = function(page)
+ {
+ if(!this.is_installed){
+ this.install(this.request());
+ }
+
+ this.update(page);
+ }
+
+ this.install = function(elements)
+ {
+ for(id in elements){
+ var el = elements[id];
+ this.el.appendChild(el)
+ }
+ document.body.appendChild(this.el)
+ this.is_installed = true;
+ }
+
+ this.update = function()
+ {
+
+ }
}
\ No newline at end of file
diff --git a/scripts/nodes/element.js b/scripts/nodes/element.js
@@ -3,4 +3,11 @@ function ElementNode(id,rect)
Node.call(this,id,rect);
this.glyph = NODE_GLYPHS.element
+ this.el = document.createElement("yu");
+ this.el.id = this.id;
+
+ this.answer = function(q)
+ {
+ return this.el
+ }
}
\ No newline at end of file
diff --git a/scripts/nodes/template.js b/scripts/nodes/template.js
@@ -3,9 +3,4 @@ function TemplateNode(id,rect)
Node.call(this,id,rect);
this.glyph = NODE_GLYPHS.builder
-
- this.receive = function(page)
- {
- console.log("page",page)
- }
}
\ No newline at end of file