Skip to content

Commit

Permalink
sabfhdj
Browse files Browse the repository at this point in the history
  • Loading branch information
joypan1 committed Mar 20, 2024
1 parent 1be3495 commit fed178e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pages/matchsummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,31 @@ window.onload = getMatches;
window.open('')
}*/

// does this need to be synced to Azure SQL? if so, add function syncDataToAzureSQL


// Function to get all data from a specified store in IndexedDB
function getAllDataFromStore(dbName, storeName) {
return new Promise((resolve, reject) => {
const openRequest = indexedDB.open(dbName);

openRequest.onupgradeneeded = () => {
// This event is only implemented in recent browsers
openRequest.result.createObjectStore(storeName, { autoIncrement: true });
};

openRequest.onerror = () => reject(openRequest.error);
openRequest.onsuccess = () => {
const db = openRequest.result;
const transaction = db.transaction(storeName, 'readonly');
const store = transaction.objectStore(storeName);
const request = store.getAll();

request.onerror = () => reject(request.error);
request.onsuccess = () => {
resolve(request.result);
db.close();
};
};
})
}

0 comments on commit fed178e

Please sign in to comment.