hlp 3.2.5 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -557,10 +557,14 @@ hlp.on('click', '.selector', '.scope', (e, el) => { });
|
|
|
557
557
|
// classic debounce
|
|
558
558
|
window.addEventListener('resize', hlp.debounce(() => { console.log('debounce at resize') }, 1000));
|
|
559
559
|
document.querySelector('.container').addEventListener('input', hlp.debounce((e) => { console.log('debounce at '+e.target.value); }, 1000));
|
|
560
|
+
let debounce = hlp.debounce((e) => { console.log('debounce at '+e.target.value); }, 1000); // conditional debounce
|
|
561
|
+
document.querySelector('.container').addEventListener('input', e => { debounce(e); });
|
|
560
562
|
|
|
561
563
|
// classic throttle
|
|
562
564
|
window.addEventListener('resize', hlp.throttle(() => { console.log('throttle at resize') }, 1000));
|
|
563
565
|
document.querySelector('.container').addEventListener('input', hlp.throttle((e) => { console.log('throttle at '+e.target.value); }, 1000));
|
|
566
|
+
let throttle = hlp.throttle((e) => { console.log('throttle at '+e.target.value); }, 1000); // conditional throttle
|
|
567
|
+
document.querySelector('.container').addEventListener('input', e => { throttle(e); });
|
|
564
568
|
|
|
565
569
|
// get current url
|
|
566
570
|
hlp.url() // https://github.com/vielhuber/hlp
|