Mercurial > code > home > repos > homeauto
comparison service/arduinoNode/static/output-widgets.html @ 1039:77e7e8d76a81
logging
Ignore-this: c0ca71c5d996fe1d51fcf371179add0f
darcs-hash:60a19a3c6f4d260fd788da93ac4ff1f2c384e120
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 30 Jan 2016 06:45:55 -0800 |
parents | ffe6a00c6cef |
children | 362de08c4c52 |
comparison
equal
deleted
inserted
replaced
1038:ffe6a00c6cef | 1039:77e7e8d76a81 |
---|---|
31 }, | 31 }, |
32 onGraphChange: function(streamedGraph) { | 32 onGraphChange: function(streamedGraph) { |
33 if (!streamedGraph.graph) { | 33 if (!streamedGraph.graph) { |
34 return; | 34 return; |
35 } | 35 } |
36 console.log('output-sender sees change to version', streamedGraph.version); | |
37 console.log('the index im about to read:', stringifyMap(streamedGraph.graph.quadStore.index)); | |
38 var env = streamedGraph.graph.store.rdf; | 36 var env = streamedGraph.graph.store.rdf; |
39 streamedGraph.graph.quadStore.quads({ | 37 streamedGraph.graph.quadStore.quads({ |
40 subject: env.createNamedNode(this.subj), | 38 subject: env.createNamedNode(this.subj), |
41 predicate: env.createNamedNode(this.pred) | 39 predicate: env.createNamedNode(this.pred) |
42 }, function(quad) { | 40 }, function(quad) { |
54 var now = Date.now(), dt = now - this.lastSendMs; | 52 var now = Date.now(), dt = now - this.lastSendMs; |
55 if (dt < this.smallestRequestPeriodMs) { | 53 if (dt < this.smallestRequestPeriodMs) { |
56 setTimeout(this.onResponse.bind(this), | 54 setTimeout(this.onResponse.bind(this), |
57 this.smallestRequestPeriodMs - dt); | 55 this.smallestRequestPeriodMs - dt); |
58 return; | 56 return; |
59 } | 57 } |
60 this.newRequestNeedsSending = false; | 58 this.newRequestNeedsSending = false; |
61 this.lastSendMs = now; | 59 this.lastSendMs = now; |
62 console.log(Date.now(), 'sending', this.$.output.body); | |
63 this.$.output.generateRequest(); | 60 this.$.output.generateRequest(); |
64 }, | 61 }, |
65 browserChangedValue: function () { | 62 browserChangedValue: function () { |
66 if (!this.subj || !this.pred) { | 63 if (!this.subj || !this.pred) { |
67 return; | 64 return; |
71 this.$.output.body = this.value; | 68 this.$.output.body = this.value; |
72 this.newRequestNeedsSending = true; | 69 this.newRequestNeedsSending = true; |
73 setTimeout(this.onResponse.bind(this), this.waitOnChangeMs); | 70 setTimeout(this.onResponse.bind(this), this.waitOnChangeMs); |
74 }, | 71 }, |
75 serverChangedValue: function(v) { | 72 serverChangedValue: function(v) { |
76 console.log('server gave', v); | |
77 this.value = v; | 73 this.value = v; |
78 this.synced = true; | 74 this.synced = true; |
79 } | 75 } |
80 }); | 76 }); |
81 </script> | 77 </script> |