1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-04-01 19:55:53 +02:00

debug options for (e.g.) document.body

This commit is contained in:
Jan Andrle 2025-02-22 16:20:24 +01:00
parent 72227a80df
commit dba4e93b88
Signed by: jaandrle
GPG Key ID: B3A25AED155AFFAB
3 changed files with 30 additions and 25 deletions

View File

@ -557,16 +557,18 @@ var st = {
};
function ut(t, e, ...r) {
let { current: n } = x;
n.prevent || n.host(function(o) {
o[D] || (o[D] = [], _.disconnected(
n.host(function(o) {
if (o[D])
return o[D].push([[t, e], ...r]);
o[D] = [], !n.prevent && _.disconnected(
() => (
/*!
* Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, ?).
* You can investigate the `__dde_reactive` key of the element.
* */
* Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, ?).
* You can investigate the `__dde_reactive` key of the element.
* */
o[D].forEach(([[c, u]]) => R(c, u, c[l] && c[l].host && c[l].host() === o))
)
)(o)), o[D].push([[t, e], ...r]);
)(o);
});
}
function it(t, e, r) {

View File

@ -555,16 +555,18 @@ var st = {
};
function ut(t, e, ...r) {
let { current: n } = x;
n.prevent || n.host(function(o) {
o[D] || (o[D] = [], _.disconnected(
n.host(function(o) {
if (o[D])
return o[D].push([[t, e], ...r]);
o[D] = [], !n.prevent && _.disconnected(
() => (
/*!
* Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, ?).
* You can investigate the `__dde_reactive` key of the element.
* */
* Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, ?).
* You can investigate the `__dde_reactive` key of the element.
* */
o[D].forEach(([[c, u]]) => R(c, u, c[l] && c[l].host && c[l].host() === o))
)
)(o)), o[D].push([[t, e], ...r]);
)(o);
});
}
function it(t, e, r) {

View File

@ -92,6 +92,8 @@ import { enviroment as env } from "./dom-common.js";
import { el } from "./dom.js";
import { scope } from "./dom.js";
// TODO: third argument for handle `cache_tmp` in re-render
// TODO: clear cache on disconnect
// TODO: extract cache to separate (exportable) function
signal.el= function(s, map){
const mark_start= el.mark({ type: "reactive" }, true);
const mark_end= mark_start.end;
@ -191,20 +193,19 @@ export const signals_config= {
};
function removeSignalsFromElements(s, listener, ...notes){
const { current }= scope;
if(current.prevent) return;
current.host(function(element){
if(!element[key_reactive]){
element[key_reactive]= [];
on.disconnected(()=>
/*!
* Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, ?).
* You can investigate the `__dde_reactive` key of the element.
* */
element[key_reactive].forEach(([ [ s, listener ] ])=>
removeSignalListener(s, listener, s[mark] && s[mark].host && s[mark].host() === element))
)(element);
}
element[key_reactive].push([ [ s, listener ], ...notes ]);
if(element[key_reactive])
return element[key_reactive].push([ [ s, listener ], ...notes ]);
element[key_reactive]= [];
if(current.prevent) return; // typically document.body, doenst need auto-remove as it should happen on page leave
on.disconnected(()=>
/*!
* Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, ?).
* You can investigate the `__dde_reactive` key of the element.
* */
element[key_reactive].forEach(([ [ s, listener ] ])=>
removeSignalListener(s, listener, s[mark] && s[mark].host && s[mark].host() === element))
)(element);
});
}