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 = indexedDB.open("mydbtest", 1.0);
So far so good.
With a open database call, I get a returned object of elemental2.indexeddb.
IDBOpenDBRequest (https://static.javadoc.io/ com.google.elemental2/ )elemental2-indexeddb/1.0.0- RC1/elemental2/indexeddb/ IDBOpenDBRequest.html
In the google documentation that I have found that describes the indexedDB open operation, https://developers.
google.com/web/ilt/pwa/ working-with-indexeddb# opening_a_database
They provide the following code:
var dbPromise = idb.open('test-db2', 1, function(upgradeDb) {
console.log('making a new object store');
if (!upgradeDb.objectStoreNames.contains ('firstOS')) {
upgradeDb.createObjectStore('firstOS' );
}
});
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= indexedDB.open("mydbtest", 1.0);
//how to i call a function for upgrade? I want to create some object stores.
openDBRequest. onupgradeneeded = doUpgrade();
openDBRequest.onupgradeneeded = new OnupgradeneededFn() {
@Override
public Object onInvoke(IDBVersionChangeEvent event) {
doUpgrade();
return Js.undefined(); // that value will likely be ignored anyway
}
};
openDBRequest.onupgradeneeded = event -> {
doUpgrade();
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment