 
 
 (defn wait-if-stale
+  "Given staleness duration and refresh-wait timeout in milliseconds, return a function `(fn [state-agent])` that
+  detects stale store and waits until timeout for a refresh.
+
+  See: [[make-dynamic-store]]"
   [^long stale-millis ^long timeout-millis]
   (fn [state-agent]
     (let [^StoreState store-state @state-agent



(defn fetch-if-error?
  [err-ts-key ^long millis-since-error]
  (fn [^StoreState store-state]
    (if-let [err-ts (get store-state err-ts-key)]



(defn fetch-every?
  "Given duration in milliseconds, return a fetch decider (predicate) function

  ```
  (fn [^keypin.type.record.StoreState store-state]) -> boolean
  ```

  that returns `true` if the duration has elapsed, `false` otherwise.

  See: [[make-dynamic-store]]"
  [^long duration-millis]
  (fn [^StoreState store-state]
    (>= (i/now-millis (.-updated-at store-state))
