mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +02:00
feat: only load kapa on interaction
This commit is contained in:
parent
2d9f5748f3
commit
04453c5663
@ -53,8 +53,6 @@ export default function Root({ children }: { children: React.ReactNode }) {
|
|||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
};
|
};
|
||||||
|
|
||||||
const timeoutId = setTimeout(loadKapaWidget, 3000);
|
|
||||||
|
|
||||||
const handleUserInteraction = () => {
|
const handleUserInteraction = () => {
|
||||||
loadKapaWidget();
|
loadKapaWidget();
|
||||||
window.removeEventListener('scroll', handleUserInteraction);
|
window.removeEventListener('scroll', handleUserInteraction);
|
||||||
@ -78,7 +76,6 @@ export default function Root({ children }: { children: React.ReactNode }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearTimeout(timeoutId);
|
|
||||||
window.removeEventListener('scroll', handleUserInteraction);
|
window.removeEventListener('scroll', handleUserInteraction);
|
||||||
window.removeEventListener('click', handleUserInteraction);
|
window.removeEventListener('click', handleUserInteraction);
|
||||||
window.removeEventListener('touchstart', handleUserInteraction);
|
window.removeEventListener('touchstart', handleUserInteraction);
|
||||||
|
Loading…
Reference in New Issue
Block a user