Re:Use labels to break ifs in JavaScript
by dclowd9901 on Wednesday August 07, 2013 @09:06PM
(#6176764)
I would use Promises to handle the situation of "returning early." Essentially, you create recursive function, and execute it in a setInterval (don't forget to bind the scope if you're doing class references!). Manage state outside the scope of the function and create a deferred object outside the scope as well. When it's done, resolve the promise and kill the .
Elsewhere, use the resident "when" function to capture the resolved state. This helps create a very secular structure of code where each method is purposeful.
Elsewhere, use the resident "when" function to capture the resolved state. This helps create a very secular structure of code where each method is purposeful.