Experiments with Dojo 1.5 Deferreds and Json Referencing

| tags: dojo, programming

Our BigWords project needs Sets which are lists of Games and SetOrders which sequence the Sets. Json References seem perfect for this but the examples I could find online did not conform to my experience with the way it actually works.

At the same time I decided to experiment with the new implementation of Deferreds in Dojo 1.5 with the .then method. I may be abusing or misusing them below; please tell me how to do better if you see any abuse.

I put the code in in a Gist at: http://gist.github.com/522994

The bottom line is Json Refs work great with JsonRestStore but not quite like the examples I see online. The code below demonstrates constructing a store full of refs, then accessing it, and getting the refs lazily loaded both manually and by a grid.

Second bottom line is the new Deferreds implementation in Dojo 1.5 rocks. I think chains of asynchronous calls are much more readable and maintainable this way.