CloServe A view first web framework in Clojure

LazyLoad

LazyLoad Example

Assume the calculation inside TestSlowLoad will take some time:

(register-lift-snippet
 "TestSlowLoad"
 [node req page-id lift-instr]
 (Thread/sleep 5000)
 (-> node 
     (assoc :content ["Lazy Load finished!"])
     (assoc-in [:attrs :class] "alert alert-success")
     )
 )

Wrap the long loading snippet with a lift:LazyLoad snippet:

<span class="lift:LazyLoad">
    <span class="lift:TestSlowLoad"></span>
</span>

Result:

Loading...