Fix lazy loading

This commit is contained in:
Tienson Qin
2020-04-12 22:19:53 +08:00
parent f1e97f279e
commit 05a63cedad
8 changed files with 30 additions and 36 deletions

View File

@@ -23,8 +23,7 @@
(.convert (js/window.Asciidoctor) content (clj->js config)))))
(loaded? [this]
(some? (loaded?)))
(lazyLoad [this ok-handler error-handler]
(lazyLoad [this ok-handler]
(loader/load
"https://cdnjs.cloudflare.com/ajax/libs/asciidoctor.js/1.5.9/asciidoctor.min.js"
ok-handler
error-handler)))
ok-handler)))

View File

@@ -18,8 +18,7 @@
(.makeHtml (js/window.showdown.Converter.) content)))
(loaded? [this]
(some? (loaded?)))
(lazyLoad [this ok-handler error-handler]
(lazyLoad [this ok-handler]
(loader/load
"https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"
ok-handler
error-handler)))
ok-handler)))

View File

@@ -27,11 +27,10 @@
(.parseHtml js/window.MldocOrg content config)))
(loaded? [this]
(some? (loaded?)))
(lazyLoad [this ok-handler error-handler]
(lazyLoad [this ok-handler]
(loader/load
(config/asset-uri "/static/js/mldoc_org.min.js")
ok-handler
error-handler)))
ok-handler)))
(defn parse-json
([content]

View File

@@ -3,4 +3,4 @@
(defprotocol Format
(toHtml [this content config])
(loaded? [this])
(lazyLoad [this ok-handler error-handler]))
(lazyLoad [this ok-handler]))