1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-04-05 13:15:53 +02:00

🐛 fixes #41

This commit is contained in:
Jan Andrle 2025-03-17 15:10:04 +01:00
parent 04f93345f8
commit 7e3b54153d
Signed by: jaandrle
GPG Key ID: B3A25AED155AFFAB
11 changed files with 42 additions and 42 deletions

View File

@ -41,6 +41,11 @@ function observedAttributes(instance, observedAttribute2) {
function kebabToCamel(name) {
return name.replace(/-./g, (x) => x[1].toUpperCase());
}
function requestIdle() {
return new Promise(function(resolve) {
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
});
}
// src/dom-lib/common.js
var enviroment = {
@ -179,11 +184,6 @@ function connectionsChangesObserverConstructor() {
is_observing = false;
observer.disconnect();
}
function requestIdle() {
return new Promise(function(resolve) {
(requestIdleCallback || requestAnimationFrame)(resolve);
});
}
async function collectChildren(element) {
if (store.size > 30)
await requestIdle();
@ -824,7 +824,7 @@ signal.el = function(s, map) {
};
function requestCleanUpReactives(host) {
if (!host || !host[key_reactive]) return;
(requestIdleCallback || setTimeout)(function() {
requestIdle().then(function() {
host[key_reactive] = host[key_reactive].filter(([s, el]) => el.isConnected ? true : (removeSignalListener(...s), false));
});
}

File diff suppressed because one or more lines are too long

10
dist/esm.js vendored
View File

@ -25,6 +25,11 @@ function onAbort(signal, listener) {
signal.removeEventListener("abort", listener);
};
}
function requestIdle() {
return new Promise(function(resolve) {
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
});
}
// src/dom-lib/common.js
var enviroment = {
@ -163,11 +168,6 @@ function connectionsChangesObserverConstructor() {
is_observing = false;
observer.disconnect();
}
function requestIdle() {
return new Promise(function(resolve) {
(requestIdleCallback || requestAnimationFrame)(resolve);
});
}
async function collectChildren(element) {
if (store.size > 30)
await requestIdle();

2
dist/esm.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -86,6 +86,11 @@ var DDE = (() => {
function kebabToCamel(name) {
return name.replace(/-./g, (x) => x[1].toUpperCase());
}
function requestIdle() {
return new Promise(function(resolve) {
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
});
}
// src/dom-lib/common.js
var enviroment = {
@ -224,11 +229,6 @@ var DDE = (() => {
is_observing = false;
observer.disconnect();
}
function requestIdle() {
return new Promise(function(resolve) {
(requestIdleCallback || requestAnimationFrame)(resolve);
});
}
async function collectChildren(element) {
if (store.size > 30)
await requestIdle();
@ -869,7 +869,7 @@ var DDE = (() => {
};
function requestCleanUpReactives(host) {
if (!host || !host[key_reactive]) return;
(requestIdleCallback || setTimeout)(function() {
requestIdle().then(function() {
host[key_reactive] = host[key_reactive].filter(([s, el]) => el.isConnected ? true : (removeSignalListener(...s), false));
});
}

File diff suppressed because one or more lines are too long

10
dist/iife.js vendored
View File

@ -67,6 +67,11 @@ var DDE = (() => {
signal.removeEventListener("abort", listener);
};
}
function requestIdle() {
return new Promise(function(resolve) {
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
});
}
// src/dom-lib/common.js
var enviroment = {
@ -205,11 +210,6 @@ var DDE = (() => {
is_observing = false;
observer.disconnect();
}
function requestIdle() {
return new Promise(function(resolve) {
(requestIdleCallback || requestAnimationFrame)(resolve);
});
}
async function collectChildren(element) {
if (store.size > 30)
await requestIdle();

2
dist/iife.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
import { enviroment as env, evc, evd } from './common.js';
import { isInstance } from "../helpers.js";
import { isInstance, requestIdle } from "../helpers.js";
/**
* Connection changes observer for tracking element connection/disconnection
@ -149,15 +149,6 @@ function connectionsChangesObserverConstructor(){
observer.disconnect();
}
//TODO: remount support?
/**
* Schedule a task during browser idle time
* @returns {Promise<void>} Promise that resolves when browser is idle
*/
function requestIdle(){ return new Promise(function(resolve){
(requestIdleCallback || requestAnimationFrame)(resolve);
}); }
/**
* Collects child elements from the store that are contained by the given element
* @param {Element} element - Parent element

View File

@ -68,3 +68,12 @@ export function observedAttributes(instance, observedAttribute){
* @returns {string} The camelCase string
*/
function kebabToCamel(name){ return name.replace(/-./g, x=> x[1].toUpperCase()); }
/**
* Schedule a task during browser idle time
* @returns {Promise<void>} Promise that resolves when browser is idle
*/
export function requestIdle(){ return new Promise(function(resolve){
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
});
}

View File

@ -1,6 +1,6 @@
import { queueSignalWrite, mark } from "./helpers.js";
export { mark };
import { hasOwn, oCreate, oAssign } from "../helpers.js";
import { hasOwn, oCreate, oAssign, requestIdle } from "../helpers.js";
const Signal = oCreate(null, {
get: { value(){ return read(this); } },
@ -214,7 +214,7 @@ signal.el= function(s, map){
*/
function requestCleanUpReactives(host){
if(!host || !host[key_reactive]) return;
(requestIdleCallback || setTimeout)(function(){
requestIdle().then(function(){
host[key_reactive]= host[key_reactive]
.filter(([ s, el ])=> el.isConnected ? true : (removeSignalListener(...s), false));
});