Book Image

Lo-Dash Essentials

By : Adam Boduch
Book Image

Lo-Dash Essentials

By: Adam Boduch

Overview of this book

Table of Contents (15 chapters)
Lo-Dash Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Timed execution


By nature, JavaScript code executes synchronously, that is, you don't have multiple threads of control, each running a piece of your code and competing for the CPU's attention. There are web workers in modern browsers, but these are far from commonplace yet and don't share much similarity with a threading API you'd find in another language. The upside to all of this is that you, as the programmer, don't need to concern yourself with synchronization primitives and all the other nasty details associated with multithreaded programming.

Instead, you face a different kind of difficulty in that you have to deal with events, the DOM, and other forms of callbacks; so much for synchronous code. Sometimes, this is actually desired. For example, you need to wait for a predetermined amount of time before something can happen. Or, perhaps you want to update the DOM and then pick up where you left off. Lo-Dash has tools that help you figure out the tricky details when it comes to timing...