mirror of
https://github.com/jaandrle/deka-dom-el
synced 2025-07-01 12:22:15 +02:00
⚡ Refact docs and examples (linting) (#22)
This commit is contained in:
@ -82,12 +82,12 @@ function connectionsChangesObserverConstructor(){
|
||||
is_observing= false;
|
||||
observer.disconnect();
|
||||
}
|
||||
//TODO remount support?
|
||||
//TODO: remount support?
|
||||
function requestIdle(){ return new Promise(function(resolve){
|
||||
(requestIdleCallback || requestAnimationFrame)(resolve);
|
||||
}); }
|
||||
async function collectChildren(element){
|
||||
if(store.size > 30)//TODO limit?
|
||||
if(store.size > 30)//TODO?: limit
|
||||
await requestIdle();
|
||||
const out= [];
|
||||
if(!(element instanceof Node)) return out;
|
||||
@ -103,10 +103,10 @@ function connectionsChangesObserverConstructor(){
|
||||
for(const element of addedNodes){
|
||||
if(is_root) collectChildren(element).then(observerAdded);
|
||||
if(!store.has(element)) continue;
|
||||
|
||||
|
||||
const ls= store.get(element);
|
||||
if(!ls.length_c) continue;
|
||||
|
||||
|
||||
element.dispatchEvent(new Event(evc));
|
||||
ls.connected= new WeakSet();
|
||||
ls.length_c= 0;
|
||||
@ -120,7 +120,7 @@ function connectionsChangesObserverConstructor(){
|
||||
for(const element of removedNodes){
|
||||
if(is_root) collectChildren(element).then(observerRemoved);
|
||||
if(!store.has(element)) continue;
|
||||
|
||||
|
||||
const ls= store.get(element);
|
||||
if(!ls.length_d) continue;
|
||||
(globalThis.queueMicrotask || setTimeout)(dispatchRemove(element));
|
||||
|
Reference in New Issue
Block a user