Browse Source

HTMl generation delayed to the last key press

master
Christian Mueller 12 years ago
parent
commit
6ba9ecac4d
  1. 18
      src-cljs/main.cljs

18
src-cljs/main.cljs

@ -25,14 +25,24 @@ @@ -25,14 +25,24 @@
; try to detect iOS
(def ios-detected (.match (.-userAgent js/navigator) "(iPad|iPod|iPhone)"))
(def timer nil)
(def timerDelay
; TODO: also test for Android
(if ios-detected 800 400))
(defn update-preview
"Updates the preview"
[]
(do
(show $dashed-line)
(show $input-elems)
(inner $preview
(.makeHtml md-converter (val $draft)))))
(js/clearTimeout timer)
(def timer
(js/setTimeout
#(do
(show $dashed-line)
(show $input-elems)
(inner $preview
(.makeHtml md-converter (val $draft)))) timerDelay))))
; set focus to the draft textarea (if there is one)
(when $action

Loading…
Cancel
Save