-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from dstorie80/dev/client
Updated client group and can launch but with errors
- Loading branch information
Showing
5 changed files
with
1,171 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
import { openDB } from 'idb'; | ||
import { openDB } from "idb"; | ||
|
||
const initdb = async () => | ||
openDB('jate', 1, { | ||
openDB("jate", 1, { | ||
upgrade(db) { | ||
if (db.objectStoreNames.contains('jate')) { | ||
console.log('jate database already exists'); | ||
if (db.objectStoreNames.contains("jate")) { | ||
console.log("jate database already exists"); | ||
return; | ||
} | ||
db.createObjectStore('jate', { keyPath: 'id', autoIncrement: true }); | ||
console.log('jate database created'); | ||
db.createObjectStore("jate", { keyPath: "id", autoIncrement: true }); | ||
console.log("jate database created"); | ||
}, | ||
}); | ||
|
||
// TODO: Add logic to a method that accepts some content and adds it to the database | ||
export const putDb = async (content) => console.error('putDb not implemented'); | ||
export const putDb = async (content) => { | ||
const db = await openDB("jate", 1); | ||
const transaction = db.transaction("jate", "readwrite"); | ||
const store = transaction.objectStore("jate"); | ||
await store.add(content); | ||
await transaction.done; | ||
}; | ||
|
||
// TODO: Add logic for a method that gets all the content from the database | ||
export const getDb = async () => console.error('getDb not implemented'); | ||
export const getDb = async () => { | ||
const db = await openDB("jate", 1); | ||
const transaction = db.transaction("jate", "readonly"); | ||
const store = transaction.objectStore("jate"); | ||
const content = await store.getAll(); | ||
await transaction.done; | ||
return content; | ||
}; | ||
|
||
initdb(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
const butInstall = document.getElementById('buttonInstall'); | ||
const butInstall = document.getElementById("buttonInstall"); | ||
|
||
// Logic for installing the PWA | ||
// TODO: Add an event handler to the `beforeinstallprompt` event | ||
window.addEventListener('beforeinstallprompt', (event) => {}); | ||
window.addEventListener("beforeinstallprompt", (event) => {}); | ||
|
||
// TODO: Implement a click event handler on the `butInstall` element | ||
butInstall.addEventListener('click', async () => {}); | ||
butInstall.addEventListener("click", async () => {}); | ||
|
||
// TODO: Add an handler for the `appinstalled` event | ||
window.addEventListener('appinstalled', (event) => {}); | ||
window.addEventListener("appinstalled", (event) => {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.