Tuesday, August 9, 2016

Add sleeps or yields to JavaScript loops with Sequencr.js

Add sleeps or yields to JavaScript loops with Sequencr.js

Ever wish JavaScript had a built-in sleep function to help you build loops for computationally difficult tasks without killing the browser? Yea, we all have. Obviously we can always cascade setTimeouts, but can get messy fairly quickly.

Recently, I published a JavaScript library, Sequencr.js, that's helped me with this problem. It's fairly simple, but so deceptively useful that I've found myself using it in tons of different projects. Check out the project page:


Enjoy!

Update

Sequencr.js is now  a fully functional promise library. It makes promises a lot easier to work with and adds some interesting design patterns like asynchronous promise-based iterators. 

No comments:

Post a Comment