IndexedDb Database access

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

IndexedDb Database access

Postby MaheshWalde » Thu Sep 21, 2023 12:31 am

Hi ,
I want to track the changes done by browser in IndexedDB database i.e.(database created , insertions, updates , deletion in objectstore ) and save those changes somewhere , How can I do it ?
I am trying to do it using proxy using following code but i am not getting it .onsuccess , onerror or any other event.

Code:

const handler = {
apply: function apply(target, thisArg, argumentsList) {
console.log("****************** argumentsList = ", argumentsList);
const result = target.apply(thisArg, argumentsList);

console.log("*********************** RETURNNING RESULT = *****************", result);

result.onblocked = (event) => {
console.log("*********************** INSIDE ONBLOCKED ***************");
};
result.onupgradeneeded = (event) => {
console.log("*********************** INSIDE ONUPGRADENEEDED *****************");
};


result.onsuccess = function(event) {
console.log("*********************** INSIDE ONSUCCESS *****************");
const db = event.target.result;
console.log(`Database opened successfully: ${db.name}`);
// Log schema (object stores) or perform other actions
};

result.onerror = function(event) {
console.error("******************** Error opening database:", event.target.error);
};

return result;

}
};


if (window.indexedDB) {
window.indexedDB.open = new Proxy(window.indexedDB.open, handler);
}
MaheshWalde
Newbie
 
Posts: 1
Joined: Wed Sep 20, 2023 6:00 am

Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 139 guests