From 1cb1a8420caaa1d96f7658ff77da65781c6c68ff Mon Sep 17 00:00:00 2001 From: Jan Andrle Date: Mon, 11 Sep 2023 18:30:06 +0200 Subject: [PATCH] :memo: add comment to processReactiveAttribute --- src/signals-lib.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/signals-lib.js b/src/signals-lib.js index f1d5729..8613699 100644 --- a/src/signals-lib.js +++ b/src/signals-lib.js @@ -87,10 +87,11 @@ export const signals_config= { isTextContent(attributes){ return typeOf(attributes)==="string" || ( isSignal(attributes) && typeOf(valueOfSignal(attributes))==="string" ); }, - processReactiveAttribute(_, key, attrS, assignNth){ - if(!isSignal(attrS)) return attrS; - addSignalListener(attrS, attr=> assignNth([ key, attr ])); - return attrS(); + processReactiveAttribute(_, key, attrs, assignNth){ + //TODO DOC: once the signal is used as attribute, there is no reason to use assign again (if for some reason needed, use imperative listeners clear with `S.clear`) + if(!isSignal(attrs)) return attrs; + addSignalListener(attrs, attr=> assignNth([ key, attr ])); + return attrs(); } };