simplyflow 0.7.4 → 0.7.5

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.
@@ -274,6 +274,19 @@
274
274
  attributesOldValue: true
275
275
  });
276
276
  observers.set(el, observer);
277
+ if (el.matches("input, textarea, select")) {
278
+ let prevValue = el.value;
279
+ el.addEventListener("change", (evt) => {
280
+ notifySet(signal2, makeContext("value", { was: prevValue, now: el.value }));
281
+ prevValue = el.value;
282
+ });
283
+ if (el.matches("input, textarea")) {
284
+ el.addEventListener("input", (evt) => {
285
+ notifySet(signal2, makeContext("value", { was: prevValue, now: el.value }));
286
+ prevValue = el.value;
287
+ });
288
+ }
289
+ }
277
290
  }
278
291
  }
279
292
  function makeContext(property, change) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplyflow",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Flow based programming in javascript, with signals and effects",
5
5
  "main": "src/flow.mjs",
6
6
  "type": "module",
package/src/state.mjs CHANGED
@@ -324,6 +324,19 @@ function domListen(el, signal) {
324
324
  })
325
325
  observers.set(el, observer)
326
326
  //@TODO: unregister the observer when el is removed from the dom (after a timeout)
327
+ if (el.matches('input, textarea, select')) {
328
+ let prevValue = el.value
329
+ el.addEventListener('change', (evt) => {
330
+ notifySet(signal, makeContext('value', { was: prevValue, now: el.value }))
331
+ prevValue = el.value
332
+ })
333
+ if (el.matches('input, textarea')) {
334
+ el.addEventListener('input', (evt) => {
335
+ notifySet(signal, makeContext('value', { was: prevValue, now: el.value }))
336
+ prevValue = el.value
337
+ })
338
+ }
339
+ }
327
340
  }
328
341
  }
329
342