[IndexedDB] Using onupgradeneeded instead of setVersion - a shim

420 views
Skip to first unread message

Parashuram Narasimhan

unread,
May 11, 2012, 4:23:32 PM5/11/12
to chromiu...@chromium.org
The latest specification of IndexedDB has deprecated setVersion and uses onupgradeneeded for database schema changes. Chrome does not support this yet and still requires using setVersion method.

I was having trouble writing code that works across Firefox and Chrome for a project, so I wrote this shim for Chrome using which you can program against the specification and use the onupgradeneeded method. The shim takes care of calling setVersion, passing the right callbacks etc. Would love you hear your thoughts on the approach.

More details here - http://blog.nparashuram.com/2012/05/indexeddb-setversion-vs-onupgradeneeded.html

Test cases of the shim working with a Jquery IndexedDB plugin that that I wrote - http://nparashuram.com/jquery-indexeddb/test/.
The Jquery IndexedDB Plugin does not use setVersion, it uses the newer onupgradeneeded method.
Reply all
Reply to author
Forward
0 new messages