Commits

Anonymous committed fe9b2a7

Makes block-on options map optional

  • Participants
  • Parent commits 7d003de

Comments (0)

Files changed (1)

File src/lanterna/common.clj

     returning nil.
 
   "
-  [func args {:keys [interval timeout] :as opts}]
-  (let [{:keys [interval timeout]} (merge {:interval 50
-                                           :timeout Double/POSITIVE_INFINITY}
-                                          opts)]
-    (loop [timeout timeout]
-      (when (> timeout 0)
-        (let [val (apply func args)]
-          (if (nil? val)
-            (do (Thread/sleep interval)
-                (recur (- timeout interval)))
-            val))))))
+  ([func args] (block-on func args {}))
+  ([func args {:as opts
+               :keys [interval timeout]
+               :or {interval 50
+                    timeout Double/POSITIVE_INFINITY}}]
+     (loop [timeout timeout]
+       (when (> timeout 0)
+         (let [val (apply func args)]
+           (if (nil? val)
+             (do (Thread/sleep interval)
+                 (recur (- timeout interval)))
+             val))))))