Lift supports lazy loading of a snippet. This is useful when a snippet may take a long time to render, but you want to return the page to the browser quickly.


The Markup:

  <div>
    <lift:lazy-load><div class="lift:LongTime"></div></lift:lazy-load>
  </div>

The Scala Code:

object LongTime {
  def render = {
    val delay = 1000L + randomLong(10000)

    Thread.sleep(delay)
    
    <div>
    This thread delayed {delay / 1000L} seconds
    </div>
  }
}