From 7e0d688cd69c8a0238da8276f7371b2a5603a566 Mon Sep 17 00:00:00 2001 From: Kevin Bulteel Date: Thu, 11 Jan 2024 14:58:31 +0100 Subject: [PATCH] fix: keep this value in functions --- .../@hec.js/ui/example/classes/index.html | 47 +++++++++++++++++++ packages/@hec.js/ui/lib/src/props.js | 8 +++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 packages/@hec.js/ui/example/classes/index.html diff --git a/packages/@hec.js/ui/example/classes/index.html b/packages/@hec.js/ui/example/classes/index.html new file mode 100644 index 0000000..a1f1d0f --- /dev/null +++ b/packages/@hec.js/ui/example/classes/index.html @@ -0,0 +1,47 @@ + + + + + + hec.js :: Classes + + + + + + + + diff --git a/packages/@hec.js/ui/lib/src/props.js b/packages/@hec.js/ui/lib/src/props.js index 0cabfff..96d7391 100644 --- a/packages/@hec.js/ui/lib/src/props.js +++ b/packages/@hec.js/ui/lib/src/props.js @@ -77,7 +77,13 @@ export function prop(props, key) { } else if (typeof props === 'function') { props = f(props); } else if (typeof props[p] !== 'undefined') { - props = props[p]; + + if (typeof props[p] === 'function' && !isSignal(props[p])) { + props = props[p].bind(props); + } else { + props = props[p]; + } + } else { return null; }