View
5.677
Download
6
Category
Tags:
Preview:
DESCRIPTION
A refresher on IndexedDB, how the API evolved from its initial versions. Example of LINQ on IndexedDB, IndexedDB-Jquery Plugin and some requirements from IndexedDB
Citation preview
IndexedDBDesigning the API
Long time ago, in a galaxy far far away …
Applications• Partially Connected Applications– Can work offline also – Email, Calendar, Source Control ?
• Offline Applications– No connection to the internet required–Word processors, todo lists
• Data Caches– Privacy, Save bandwidth,– Shopping carts, user preferences
IndexedDB Example
http://yourwebpage.com search
Database
Cursor on Object Store
Object Storekey : valuekey : valuekey : value
Index
Cursor on Index
Database
Cursor on Object Store
Object Storekey : valuekey : valuekey : value
Index
Cursor on Index
... IndexedDB refresher...
• Transactions : Explicit, auto-commit• Two Flavors – Async on Main browser thread– Sync on Web Workers
... more star wars like text ...
• Cookies – – Limited storage, key value pairs– and the cookie monster
• Local Storage– Not a database, don’t fake it
… days of the old republic …
... restoring balance to the force ...
• Google Gears:Database module– First release: 2007-05-31– Database API based on SQLite – built in
DB
• Web Database API– Dialect of SQLite 3 (ref)– Frozen (ref)
… the birth of a hero …
• WebSimpleDB– ISAM based store – influenced by
Berkley DB– Concepts of Entity Store, Indexes,
Cursors–Most APIs were synchronous– Async models – function callbacks
– Entity Joins, Sequences and Queues
• Implemented in Chrome 12, Firefox 4.0, IE10
• Uniform Requests API• Concrete Asynchronous API• Use Structured Cloning Algorithm
the dojohttp
://nparashuram.com/ttd/IndexedDB/index.html
… the force is strong with this one.…
• Microsoft and Mozilla bless the youngling
• Concept of requests introduced• Security concerns addressed– Authorization section– Privacy Section
• No more joins, sequences, queues• Explicit transactions
… young hero shows promise…
Come over to the dark side*
• NoSQL – Really ? • No, No SQL
– So what should I do for querying ? • You got Cursors, Indexes
– But complex joins ? NoSQL ? • Build something on top, we need least
common denominator
– Fine, here is what I’ve done• SHOW ME
–… Stop talking you will …
… encountering the Sith Lord …
• Language Integrated Query Language• Sounds like english – – from table in database, select something
when some condition and order by something.
• Why NoSQL ? – Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaghhhh– – Just an experiment, how about we team up
and write a SQL wrapper on this and see how it looks like?
http://nparashuram.com/IndexedDB/LINQ/index.html
… what a piece of junk! …
…the ability to speak doesn't make you intelligent …
• Syntax looks verbose • I no Javascript, can I haz Jquery?
• IndexedDB Wrapper on Javascript• Less verbose with use of promises,
implicit operations
http://nparashuram.com/IndexedDB/jquery/index.html
• Multi Column Indexes – aka Joins – Perform union and intersection in JS ?
• Full Text Search– Proposed, but punted to next version
• DB rollback– Versions supported, but no DB version
revert
• Change Tracking and Sync with Server– I need to contact my mothership–the USS
enterprise
… i find your lack of faith disturbing…
• No DOM interaction• Impact of ECMA.Next– IndexedDB module – Promises– Iterators, Generators, Yield support– Save binary blobs– De-structuring assignments [x,y] = [1,2]– Classes as Object Schema
… always in motion is the future …
May the force be with you
@nparashuramhttp://nparashuram.com
http://nparashuram.com/IndexedDB
Recommended