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:
parent
04f93345f8
commit
7e3b54153d
12
dist/esm-with-signals.js
vendored
12
dist/esm-with-signals.js
vendored
@ -41,6 +41,11 @@ function observedAttributes(instance, observedAttribute2) {
|
|||||||
function kebabToCamel(name) {
|
function kebabToCamel(name) {
|
||||||
return name.replace(/-./g, (x) => x[1].toUpperCase());
|
return name.replace(/-./g, (x) => x[1].toUpperCase());
|
||||||
}
|
}
|
||||||
|
function requestIdle() {
|
||||||
|
return new Promise(function(resolve) {
|
||||||
|
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// src/dom-lib/common.js
|
// src/dom-lib/common.js
|
||||||
var enviroment = {
|
var enviroment = {
|
||||||
@ -179,11 +184,6 @@ function connectionsChangesObserverConstructor() {
|
|||||||
is_observing = false;
|
is_observing = false;
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
}
|
}
|
||||||
function requestIdle() {
|
|
||||||
return new Promise(function(resolve) {
|
|
||||||
(requestIdleCallback || requestAnimationFrame)(resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function collectChildren(element) {
|
async function collectChildren(element) {
|
||||||
if (store.size > 30)
|
if (store.size > 30)
|
||||||
await requestIdle();
|
await requestIdle();
|
||||||
@ -824,7 +824,7 @@ signal.el = function(s, map) {
|
|||||||
};
|
};
|
||||||
function requestCleanUpReactives(host) {
|
function requestCleanUpReactives(host) {
|
||||||
if (!host || !host[key_reactive]) return;
|
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));
|
host[key_reactive] = host[key_reactive].filter(([s, el]) => el.isConnected ? true : (removeSignalListener(...s), false));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
6
dist/esm-with-signals.min.js
vendored
6
dist/esm-with-signals.min.js
vendored
File diff suppressed because one or more lines are too long
10
dist/esm.js
vendored
10
dist/esm.js
vendored
@ -25,6 +25,11 @@ function onAbort(signal, listener) {
|
|||||||
signal.removeEventListener("abort", listener);
|
signal.removeEventListener("abort", listener);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
function requestIdle() {
|
||||||
|
return new Promise(function(resolve) {
|
||||||
|
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// src/dom-lib/common.js
|
// src/dom-lib/common.js
|
||||||
var enviroment = {
|
var enviroment = {
|
||||||
@ -163,11 +168,6 @@ function connectionsChangesObserverConstructor() {
|
|||||||
is_observing = false;
|
is_observing = false;
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
}
|
}
|
||||||
function requestIdle() {
|
|
||||||
return new Promise(function(resolve) {
|
|
||||||
(requestIdleCallback || requestAnimationFrame)(resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function collectChildren(element) {
|
async function collectChildren(element) {
|
||||||
if (store.size > 30)
|
if (store.size > 30)
|
||||||
await requestIdle();
|
await requestIdle();
|
||||||
|
2
dist/esm.min.js
vendored
2
dist/esm.min.js
vendored
File diff suppressed because one or more lines are too long
12
dist/iife-with-signals.js
vendored
12
dist/iife-with-signals.js
vendored
@ -86,6 +86,11 @@ var DDE = (() => {
|
|||||||
function kebabToCamel(name) {
|
function kebabToCamel(name) {
|
||||||
return name.replace(/-./g, (x) => x[1].toUpperCase());
|
return name.replace(/-./g, (x) => x[1].toUpperCase());
|
||||||
}
|
}
|
||||||
|
function requestIdle() {
|
||||||
|
return new Promise(function(resolve) {
|
||||||
|
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// src/dom-lib/common.js
|
// src/dom-lib/common.js
|
||||||
var enviroment = {
|
var enviroment = {
|
||||||
@ -224,11 +229,6 @@ var DDE = (() => {
|
|||||||
is_observing = false;
|
is_observing = false;
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
}
|
}
|
||||||
function requestIdle() {
|
|
||||||
return new Promise(function(resolve) {
|
|
||||||
(requestIdleCallback || requestAnimationFrame)(resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function collectChildren(element) {
|
async function collectChildren(element) {
|
||||||
if (store.size > 30)
|
if (store.size > 30)
|
||||||
await requestIdle();
|
await requestIdle();
|
||||||
@ -869,7 +869,7 @@ var DDE = (() => {
|
|||||||
};
|
};
|
||||||
function requestCleanUpReactives(host) {
|
function requestCleanUpReactives(host) {
|
||||||
if (!host || !host[key_reactive]) return;
|
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));
|
host[key_reactive] = host[key_reactive].filter(([s, el]) => el.isConnected ? true : (removeSignalListener(...s), false));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
6
dist/iife-with-signals.min.js
vendored
6
dist/iife-with-signals.min.js
vendored
File diff suppressed because one or more lines are too long
10
dist/iife.js
vendored
10
dist/iife.js
vendored
@ -67,6 +67,11 @@ var DDE = (() => {
|
|||||||
signal.removeEventListener("abort", listener);
|
signal.removeEventListener("abort", listener);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
function requestIdle() {
|
||||||
|
return new Promise(function(resolve) {
|
||||||
|
(globalThis.requestIdleCallback || requestAnimationFrame)(resolve);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// src/dom-lib/common.js
|
// src/dom-lib/common.js
|
||||||
var enviroment = {
|
var enviroment = {
|
||||||
@ -205,11 +210,6 @@ var DDE = (() => {
|
|||||||
is_observing = false;
|
is_observing = false;
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
}
|
}
|
||||||
function requestIdle() {
|
|
||||||
return new Promise(function(resolve) {
|
|
||||||
(requestIdleCallback || requestAnimationFrame)(resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function collectChildren(element) {
|
async function collectChildren(element) {
|
||||||
if (store.size > 30)
|
if (store.size > 30)
|
||||||
await requestIdle();
|
await requestIdle();
|
||||||
|
2
dist/iife.min.js
vendored
2
dist/iife.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
|||||||
import { enviroment as env, evc, evd } from './common.js';
|
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
|
* Connection changes observer for tracking element connection/disconnection
|
||||||
@ -149,15 +149,6 @@ function connectionsChangesObserverConstructor(){
|
|||||||
observer.disconnect();
|
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
|
* Collects child elements from the store that are contained by the given element
|
||||||
* @param {Element} element - Parent element
|
* @param {Element} element - Parent element
|
||||||
|
@ -68,3 +68,12 @@ export function observedAttributes(instance, observedAttribute){
|
|||||||
* @returns {string} The camelCase string
|
* @returns {string} The camelCase string
|
||||||
*/
|
*/
|
||||||
function kebabToCamel(name){ return name.replace(/-./g, x=> x[1].toUpperCase()); }
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { queueSignalWrite, mark } from "./helpers.js";
|
import { queueSignalWrite, mark } from "./helpers.js";
|
||||||
export { mark };
|
export { mark };
|
||||||
import { hasOwn, oCreate, oAssign } from "../helpers.js";
|
import { hasOwn, oCreate, oAssign, requestIdle } from "../helpers.js";
|
||||||
|
|
||||||
const Signal = oCreate(null, {
|
const Signal = oCreate(null, {
|
||||||
get: { value(){ return read(this); } },
|
get: { value(){ return read(this); } },
|
||||||
@ -214,7 +214,7 @@ signal.el= function(s, map){
|
|||||||
*/
|
*/
|
||||||
function requestCleanUpReactives(host){
|
function requestCleanUpReactives(host){
|
||||||
if(!host || !host[key_reactive]) return;
|
if(!host || !host[key_reactive]) return;
|
||||||
(requestIdleCallback || setTimeout)(function(){
|
requestIdle().then(function(){
|
||||||
host[key_reactive]= host[key_reactive]
|
host[key_reactive]= host[key_reactive]
|
||||||
.filter(([ s, el ])=> el.isConnected ? true : (removeSignalListener(...s), false));
|
.filter(([ s, el ])=> el.isConnected ? true : (removeSignalListener(...s), false));
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user