public
Description: JavaScript Application Framework - JS library only
Home | Edit | New

Software Updates for SproutCore Applications

Ideally, you want your SproutCore applications to be fully cacheable in production. Only your Ajax/XHR requests get data that could change from launch to launch.

This presents a problem when you need to update your application frequently. Here’s what I do:

  1. I make my SproutCore applications cacheable “forever”.
  2. In clients/my_app/core.js, I include a numeric version property, which I keep synchronized with my server.
  3. Whenever I return an Ajax request from my server, I also send back the version property. In my Ajax response processing code, I check the value of version in the response; if it’s later than the one stored in my SproutCore application, I refresh() the page, loading the latest version of my SproutCore application.

This process is almost completely transparent to the user, and gives you maximum cache-ability.

NOTE: If you have unsaved data that the user could lose, you’d probably want to alert the user and give them a chance to save their data first before you refresh() the page.

Comments

This sounds great, but it needs more detail for beginners. Can you post your code to a gist and provide more detailed explanation of how your code works?

Last edited by mattdipasquale, Wed Aug 20 19:56:53 -0700 2008
Home | Edit | New
Versions: