From be3f72bd9e834534848a5625f958cf9c75013922 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 Nov 2023 13:18:27 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../static/django-browser-reload/reload-listener.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/django_browser_reload/static/django-browser-reload/reload-listener.js b/src/django_browser_reload/static/django-browser-reload/reload-listener.js index fb8892a..11eba12 100644 --- a/src/django_browser_reload/static/django-browser-reload/reload-listener.js +++ b/src/django_browser_reload/static/django-browser-reload/reload-listener.js @@ -8,12 +8,12 @@ if (!window.SharedWorker) { console.debug('😭 django-browser-reload cannot work in this browser.') } else { - function debounce(func, timeout = 300){ - let timer; + function debounce (func, timeout = 300) { + let timer return (...args) => { - clearTimeout(timer); - timer = setTimeout(() => { func.apply(this, args); }, timeout); - }; + clearTimeout(timer) + timer = setTimeout(() => { func.apply(this, args) }, timeout) + } } const worker = new SharedWorker(workerScriptPath, { name: 'django-browser-reload' @@ -21,7 +21,7 @@ worker.port.addEventListener('message', (event) => { if (event.data === 'Reload') { - debounce(() => location.reload()); + debounce(() => location.reload()) } })