Bug 18809 - Some examples in the index section (3.3.4) have errors
Some examples in the index section (3.3.4) have errors
Status: RESOLVED FIXED
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API
unspecified
PC All
: P4 trivial
: ---
Assigned To: This bug has no owner yet - up for the taking
public-webapps-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-09 10:37 UTC by Arthur Barstow
Modified: 2013-03-01 19:54 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Barstow 2012-09-09 10:37:54 UTC
The following email reported errors in the examples in the "index" section (3.3.4):

[[
http://lists.w3.org/Archives/Public/public-webapps/2012JulSep/0672.html

As far as I can tell, there is no "openIndex" method as shown in the "var index" example below.  I think it should be objectStore.index() ?  Also, I am assuming that the var vtx is a versionchange transaction object, but vtx is not defined anywhere else in the documentation.  Just figured I would pass these along :)   

3.3.4 Index

var db = indexedDBSync.open('AddressBook', 2, function(trans, oldVersion) {
  if (oldVersion === 1) {
    trans.db.createObjectStore('Contact', {keyPath:'id', autoIncrement:true});
  }
  var store = vtx.objectStore('Contact');
  store.createIndex('ContactName', {unique:false, multiEntry:false});
});

var index = store.openIndex('ContactName');
var id = index.get('Lincoln');
// id === 1
]]
Comment 1 Joshua Bell 2013-03-01 19:54:14 UTC
Fixed in https://dvcs.w3.org/hg/IndexedDB/rev/8fa2c15e036c

Not that anyone cares about the sync API. The async API examples are still AWOL.