Open trialforce opened 6 years ago
I made a simple test, without dexie, to see if it work.
The websql example works, but shim don't, same error:
Uncaught TypeError: Cannot read property '__db' of undefined at indexeddbshim.js:5650
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>TODO write content</div>
<script src="polyfill.min.js"></script>
<script src="indexeddbshim.js"></script>
<script>
var db = openDatabase('mydb', '1.0', 'my first database', 2 * 1024 * 1024);
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE foo (id unique, text)');
tx.executeSql('INSERT INTO foo (id, text) VALUES (1, "synergies")');
tx.executeSql('SELECT * FROM foo', [], function (tx, results)
{
var len = results.rows.length, i;
for (i = 0; i < len; i++)
{
alert(results.rows.item(i).text);
}
});
});
</script>
<script>
(function () {
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction;
var IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange;
if (!indexedDB)
{
window.alert("Seu navegador não suporta uma versão estável do IndexedDB. Alguns recursos não estarão disponíveis.");
}
var request = indexedDB.open("DBteste", 3);
request.onerror = function (event) {
alert("Você não habilitou minha web app para usar IndexedDB?!");
};
request.onsuccess = function (event) {
db = request.result;
};
db.onerror = function (event) {
alert("Database error: " + event.target.errorCode);
};
request.onupgradeneeded = function (event) {
var db = event.target.result;
var objectStore = db.createObjectStore("nome", {keyPath: "minhaChave"});
};
alert('Okay!');
})();
</script>
</body>
</html>
I'm hoping to get to some IndexedDBShim issues within one or two weeks, and maybe as with issue #330, setting @babel/preset-env might ensure our bundle is not using too advanced of features.
You might try again now with 4.0.1 which has just been released...
Hi! I'm developing a offline web app and it work very well with Android 4.4 >, but my employer need it's to work in a old 2011 tablet with Android 3.2, so I came to indexeddbshim. It has about 20 tablets with this awesome version.
I'm using dexie.js.
My code to starts with that:
When I force the shim to work the app works well in current Chrome on Windows, but inside the Webview of Android 3.2 I get the following error:
When I click the next button I get the error above.
Any tips?