Monday, January 28, 2019

Re: elemental2 indexeddb example?

On Monday, January 28, 2019 at 12:49:41 AM UTC+1, rhodebump wrote:
Thanks, I did make some progress.   I dug around a little in the javadoc and found the IndexedDbGlobal, which I was able to use to create a new database.

elemental2.indexeddb.IDBFactory indexedDB = elemental2.indexeddb.IndexedDbGlobal.indexedDB;

elemental2.indexeddb.IDBOpenDBRequest openDBRequest ="mydbtest", 1.0);

So far so good.

With a open database call, I get a returned object of elemental2.indexeddb.IDBOpenDBRequest (

In the google documentation that I have found that describes the indexedDB open operation,

They provide the following code:

  var dbPromise ='test-db2', 1, function(upgradeDb) {
.log('making a new object store');
if (!upgradeDb.objectStoreNames.contains('firstOS')) {

Note that this is using the IndexedDB Promised library, not the IndexedDB API (see
Fwiw, I'd rather use as a reference.
I want to register a function to execute when the database is upgraded.  I see there is a openDBRequest.onupgradeneeded(), but I just can't the syntax right.

elemental2.indexeddb.IDBFactory indexedDB = elemental2.indexeddb.IndexedDbGlobal.indexedDB;

elemental2.indexeddb.IDBOpenDBRequest openDBRequest ="mydbtest", 1.0);

//how to i call a function for upgrade?  I want to create some object stores.

openDBRequest. onupgradeneeded = doUpgrade();

That would be something like:

openDBRequest.onupgradeneeded = new OnupgradeneededFn() {
public Object onInvoke(IDBVersionChangeEvent event) {
return Js.undefined(); // that value will likely be ignored anyway

or, using a lambda:

openDBRequest.onupgradeneeded = event -> {
return Js.undefined();

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment