From a2e060bc5ffbe0d823a7be150a60d7cdbdcb194c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vladim=C3=ADr?= <8machy@seznam.cz>
Date: Tue, 7 Nov 2023 23:04:52 +0100
Subject: [PATCH] wip
---
index.html | 60 +++++++--
packages/signalizejs/directives/src/index.ts | 130 ++++++++++++-------
packages/signalizejs/src/Signalize.ts | 2 +-
packages/signalizejs/src/plugins/bind.ts | 29 ++---
packages/signalizejs/src/plugins/signal.ts | 9 +-
5 files changed, 150 insertions(+), 80 deletions(-)
diff --git a/index.html b/index.html
index 8ff33d2..ef83778 100755
--- a/index.html
+++ b/index.html
@@ -7,15 +7,31 @@
Index page
-
-
+
+ const smallerNumber = signal(0);
+ const largerNumber = signal(0);
+
+ smallerNumber.watch(({ newValue, oldValue }) => {
+ return {
+ value: newValue >= largerNumber() ? largerNumber() - 1 : newValue,
+ }
+ }, { execution: 'beforeSet' });
+
+ smallerNumber.watch(({ newValue, oldValue }) => {
+ console.log(newValue, oldValue);
+ });
+
+ bind(select('#smaller'), { value: smallerNumber });
+ bind(select('#larger'), { value: largerNumber });
+ bind(select('#sum'), { text: [smallerNumber, largerNumber, () => largerNumber + smallerNumber]})
+ -->
@@ -25,8 +41,36 @@
}
+
+
+
+
-
+
-