wiki-plugin-mech 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/client/mech.js +7 -1
  2. package/package.json +1 -1
package/client/mech.js CHANGED
@@ -48,6 +48,7 @@
48
48
  }
49
49
 
50
50
  function trouble(elem,message) {
51
+ if(elem.innerText.match(/✖︎/)) return
51
52
  elem.innerHTML += `<button style="border-width:0;color:red;">✖︎</button>`
52
53
  elem.querySelector('button').addEventListener('click',event => {
53
54
  elem.outerHTML += `<span style="width:80%;color:gray;">${message}</span>` })
@@ -57,7 +58,10 @@
57
58
  if(elem.innerHTML.match(/button/)) return
58
59
  if (!body?.length) return trouble(elem,'CLICK expects indented blocks to follow.')
59
60
  elem.innerHTML += '<button style="border-width:0;">◉</button>'
60
- elem.querySelector('button').addEventListener('click',event => run(body,state))
61
+ elem.querySelector('button').addEventListener('click',event => {
62
+ state.debug = event.shiftKey
63
+ run(body,state)
64
+ })
61
65
  }
62
66
 
63
67
  function hello_emit ({elem,args}) {
@@ -97,6 +101,7 @@
97
101
  fetch(url)
98
102
  .then (res => res.json())
99
103
  .then (data => {
104
+ if(state.debug) console.log({sensor,data})
100
105
  elem.innerHTML = line + ' ⌛'
101
106
  const value = f(avg(Object.values(data)))
102
107
  state.temperature = `${value.toFixed(2)}°F`
@@ -129,6 +134,7 @@
129
134
  const next = scope[0]
130
135
  const body = next && ('command' in next) ? null : scope.shift()
131
136
  const stuff = {command,op,args,body,elem,state}
137
+ if(state.debug) console.log(stuff)
132
138
  if (blocks[op])
133
139
  blocks[op].emit.apply(null,[stuff])
134
140
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-plugin-mech",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Federated Wiki - Mechanism Scripting Plugin",
5
5
  "keywords": [
6
6
  "mech",