1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-07-01 04:12:14 +02:00

🐛 lint

This commit is contained in:
2025-03-13 16:24:47 +01:00
parent 9251e70015
commit 3c6cad5648
2 changed files with 9 additions and 9 deletions

View File

@ -25,21 +25,21 @@ function createDebouncedSignal(initialValue, delay = 300) {
// Create two signals: one for immediate updates, one for debounced values
const immediateSignal = S(initialValue);
const debouncedSignal = S(initialValue);
// Keep track of the timeout
let timeout = null;
// Set up a listener on the immediate signal
S.on(immediateSignal, value => {
// Clear any existing timeout
if (timeout) clearTimeout(timeout);
// Set a new timeout to update the debounced signal
timeout = setTimeout(() => {
debouncedSignal.set(value);
}, delay);
});
// Return an object with both signals and a setter function
return {
// The raw signal that updates immediately
@ -64,4 +64,4 @@ S.on(searchInput.debounced, value => {
});
// In your input handler
searchElement.addEventListener("input", e => searchInput.set(e.target.value));
searchElement.addEventListener("input", e => searchInput.set(e.target.value));