mirror of
https://github.com/jaandrle/deka-dom-el
synced 2026-05-14 01:11:23 +02:00
🐛 ensures only one disconncetd listener
…for cleanup
This commit is contained in:
Vendored
+3
-2
@@ -886,9 +886,10 @@ var signals_config = {
|
||||
function removeSignalsFromElements(s, listener, ...notes) {
|
||||
const { current } = scope;
|
||||
current.host(function(element) {
|
||||
if (!element[key_reactive]) element[key_reactive] = [];
|
||||
const is_first = !element[key_reactive];
|
||||
if (is_first) element[key_reactive] = [];
|
||||
element[key_reactive].push([[s, listener], ...notes]);
|
||||
if (current.prevent) return;
|
||||
if (!is_first || current.prevent) return;
|
||||
on.disconnected(
|
||||
() => (
|
||||
/*! Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, …?).
|
||||
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
Vendored
+3
-2
@@ -931,9 +931,10 @@ var DDE = (() => {
|
||||
function removeSignalsFromElements(s, listener, ...notes) {
|
||||
const { current } = scope;
|
||||
current.host(function(element) {
|
||||
if (!element[key_reactive]) element[key_reactive] = [];
|
||||
const is_first = !element[key_reactive];
|
||||
if (is_first) element[key_reactive] = [];
|
||||
element[key_reactive].push([[s, listener], ...notes]);
|
||||
if (current.prevent) return;
|
||||
if (!is_first || current.prevent) return;
|
||||
on.disconnected(
|
||||
() => (
|
||||
/*! Clears all Signals listeners added in the current scope/host (`S.el`, `assign`, …?).
|
||||
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
@@ -313,9 +313,14 @@ export const signals_config= {
|
||||
function removeSignalsFromElements(s, listener, ...notes){
|
||||
const { current }= scope;
|
||||
current.host(function(element){
|
||||
if(!element[key_reactive]) element[key_reactive]= [];
|
||||
const is_first= !element[key_reactive];
|
||||
if(is_first) element[key_reactive]= [];
|
||||
element[key_reactive].push([ [ s, listener ], ...notes ]);
|
||||
if(current.prevent) return; // typically document.body, doenst need auto-remove as it should happen on page leave
|
||||
if(
|
||||
!is_first
|
||||
// typically document.body, doenst need auto-remove as it should happen on page leave
|
||||
|| current.prevent
|
||||
) return;
|
||||
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. */
|
||||
|
||||
Reference in New Issue
Block a user