JSFiddle - React, Tailwind, and code Playground

by calfzhou

CoffeeScript

sleep = (key) ->
  console.log('enter sleep', key)
  d = $.Deferred()
  setTimeout(->
    console.log('sleep done', key)
    d.resolve()
  , 2 * 1000)
  d.promise()

sleep(1)
.then ->  sleep(2)
.then -> sleep(3)
.then -> sleep(4)
.then -> sleep(5)