aboutsummaryrefslogtreecommitdiff
path: root/src/services/fetcher/fetcher.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/services/fetcher/fetcher.js')
-rw-r--r--src/services/fetcher/fetcher.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/services/fetcher/fetcher.js b/src/services/fetcher/fetcher.js
index 5a6ed4b8..aae1c2cc 100644
--- a/src/services/fetcher/fetcher.js
+++ b/src/services/fetcher/fetcher.js
@@ -1,9 +1,9 @@
// makeFetcher - replacement for setInterval for fetching, starts counting
// the interval only after a request is done instead of immediately.
-// promiseCall is a function that returns a promise, it's called when created
-// and after every interval.
-// interval is the interval delay in ms.
+// - promiseCall is a function that returns a promise, it's called the first
+// time after the first interval.
+// - interval is the interval delay in ms.
export const makeFetcher = (promiseCall, interval) => {
let stopped = false
@@ -22,7 +22,7 @@ export const makeFetcher = (promiseCall, interval) => {
window.clearTimeout(timeout)
}
- func()
+ timeout = window.setTimeout(func, interval)
return stopFetcher
}