A solution to using Thread.Sleep() inside JavaScript.