diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-12-30 15:53:04 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-12-30 15:53:04 -0500 |
commit | be73a31fb83c7da398322f6e92e94a7297212b7c (patch) | |
tree | 78c801a52c645b6780e00ffc222f2d96e027f2b0 /jslib | |
parent | 8d3edc5aaa4617dd06623447cf9357067eadc072 (diff) |
Propagated a source change into a dynamic document element
Diffstat (limited to 'jslib')
-rw-r--r-- | jslib/urweb.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/jslib/urweb.js b/jslib/urweb.js index eab67626..86c3808c 100644 --- a/jslib/urweb.js +++ b/jslib/urweb.js @@ -1,11 +1,18 @@ -function sc(v) { return {v : v} } +function callAll(ls) { + for (; ls; ls = ls.next) + ls.v(); +} + +function sc(v) { return {v : v, h : null} } +function sv(s, v) { s.v = v; callAll(s.h); } -function ss(s) { return {v : s.v} } -function sr(v) { return {v : v} } -function sb(x,y) { return {v : y(x.v).v} } +function ss(s) { return s } +function sr(v) { return {v : v, h : null} } +function sb(x,y) { return {v : y(x.v).v, h : null} } function dyn(s) { var x = document.createElement("span"); x.innerHTML = s.v; document.body.appendChild(x); + s.h = { n : s.h, v : function() { x.innerHTML = s.v } }; } |