My IndexedDB recording, and a few notes

Here is the recording URL for the presentation I just gave on IndexedDB: http://experts.adobeconnect.com/p30v2nmantc/

You can find the full source code for the demos and slide deck here: https://github.com/cfjedimaster/indexeddb-preso

Now for some random notes:

I plan on writing up this presentation as an article (not sure for whom yet, maybe Smashing Mag). But basically, I’m going to turn the presentation and demo assets into a guide that can be downloaded, read offline in the bathroom, etc.

Secondly, one topic I didn’t go into, but bit me in the butt today, was the transaction object’s “oncomplete” handler. This comes into play when doing something like this:

Add some crap.
Run a method to get all crap so I can see it listed.

I’ve had a “Note Database” demo in my presentation for a while now and it worked fine… until today. When I presented it today (and you can see my surprise in the recording), I noticed that my add/edit/delete operations were not updating the list of notes. Why? Because I was asking the system to refresh the notes in the success handler of the request (where the request was either add/edit/delete). Instead, I needed to wait for the transaction to end as a whole.

As an example of this mistake, here is my original code for delete:

Notice that displayNotes() is in the request success handler. Here is the corrected version.

I’ve broken up my chained calls there a bit so I get access to the transaction and add the oncomplete there.

Previously this wasn’t required in Chrome, so I’m assuming something has changed, but to be honest, this feels like the right way of doing things anyway.