Matt Snider JavaScript Resource

Understanding JavaScript and Frameworks

Thursday, August 9, 2007

Continuations in JavaScript

I had heard of the term ‘Continuation’ before, but had only glanced at it and never thought about how it could apply to JavaScript. Fortunately, someone else did the thinking for me. The low-down is that the Continuation Pattern can be used when executing really slow JavaScript algorithms that lock up the browser. By doing a Continuation, you can ‘chunk’ Function algorithms into smaller processes and free up the browser so that the user isn’t stuck waiting 5 seconds for your complex JavaScript algorithm to finish. For a detailed explanation check out Marijn Haverbeke article:

http://marijn.haverbeke.nl/cps/

posted by Matt Snider at 11:08 am  

2 Comments »

  1. hi i enjoyed the read

    Comment by Kyla — August 18, 2007 @ 6:20 pm

  2. Looks good, but for me it’s too confusing. :P

    I like putting function into another function, say, nested scopes.

    Sometimes when I create a sortable table where user can click on the header to sort it, I like to use setTimeout when the function is rearranging the table rows. In fact, using setTimeout when sorting a table gives me a cool animation effect also. I love JavaScript animation! :)

    Comment by the DtTvB — August 24, 2007 @ 4:54 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress