IndexedDB with Wappler

Hi @patrick ,

I have an application that uses IndexedDB. Wappler can’t work yet with IndexedDB. However, I have prepared the following function for this.

function getAllContacts(db) {
    var request = window.indexedDB.open("ngDataBase-5016456", 6);
    request.onsuccess = function (event) {
        db = request.result;
        const txn = db.transaction(["messages"]);
        const objectStore = txn.objectStore('messages');
        objectStore.openCursor().onsuccess = (event) => {
            let cursor = event.target.result;
            if (cursor) {
                let contact = cursor.value;
                console.log(contact);
                // continue next record
                cursor.continue();
            }
        };
    }
    // close the database connection
    request.oncomplete = function () {
        db.close();
    };
}

The function returns the result in this way and in the following figure.


I want to use the data from here in Wappler as if it were a database query. So I want to transfer it to Wappler, can you show me a way to do that?

Community Page
Last updated: