1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-04 21:42:14 +02:00

🚧 types, linting, caching

♻️ add linting to codebase
♻️ Update prototype methods
🐛 update maxcomplexity in jshintConfig
♻️ Improve DOM element property handling
♻️ update setDelete function
 Add type annotation for signals()
♻️ Cleanup when signal removed
This commit is contained in:
2023-09-07 13:52:09 +02:00
parent a8ae99962e
commit 55a8f14b6b
11 changed files with 2721 additions and 2504 deletions

View File

@ -29,7 +29,7 @@ S.on= function on(signals, listener, options){
if(options && options.signal)
options.signal.addEventListener("abort", ()=> removeSignalListener(signals, listener));
//TODO cleanup when signal removed (also TODO)
}
};
S.clear= function(...signals){
for(const signal of signals){
signal[mark].listeners.clear();
@ -100,7 +100,7 @@ export function watch(context){
stack_watch.push(contextReWatch);
context();
stack_watch.pop();
};
}
function currentContext(){
return stack_watch[stack_watch.length - 1];
}
@ -116,7 +116,7 @@ function write(signal, value){
const s= signal[mark];
if(s.value===value) return;
s.value= value;
s.listeners.forEach(fn=> fn(value))
s.listeners.forEach(fn=> fn(value));
return value;
}