Fix bug with IDB, it should be much more stable now
This commit is contained in:
parent
09914ab8f7
commit
0fe23c7020
4 changed files with 16 additions and 7 deletions
|
|
@ -30,7 +30,6 @@
|
|||
result.forEach((extension: IExtensionMetadata) => {
|
||||
if (extension.type === "theme" && extension.themeName) {
|
||||
// Load theme CSS
|
||||
console.log("Attempting to load theme", extension.themeName);
|
||||
loadStyleFromAtob(atob(extension.scriptCopy!));
|
||||
|
||||
document.addEventListener("astro:after-swap", () => {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@
|
|||
console.log("%cBrowser: " + navigator.userAgent, `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`);
|
||||
console.log("%cCPU Cores: " + navigator.hardwareConcurrency, `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`);
|
||||
// Cmon firefox, do we really not support this?? Basic stuff here from the "indie browser".
|
||||
console.log("%cMemory: " + (navigator as any).deviceMemory + "GB", `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`);
|
||||
|
||||
if (!navigator.userAgent.includes("Firefox")) {
|
||||
console.log("%cMemory: " + (navigator as any).deviceMemory + "GB", `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`);
|
||||
} else {
|
||||
console.log("%cMemory: Not supported in Firefox", `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`);
|
||||
}
|
||||
console.log("%cPlease include this information in a bug report!", `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`);
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export function loadIDBPromise(name: string, version: number): Promise<IDBDataba
|
|||
request.onupgradeneeded = () => {
|
||||
const idb = request.result;
|
||||
CurrentIDB = idb;
|
||||
CurrentIDB.createObjectStore(name, { keyPath: "slug" });
|
||||
resolve(idb);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -58,10 +58,16 @@ const { title, optionalPreloads } = Astro.props;
|
|||
<script>
|
||||
import IDBManager from "@components/ts/IDBManager";
|
||||
if (!window.idb) {
|
||||
const db = await IDBManager.loadIDBPromise("AluDB", 1);
|
||||
if (db instanceof IDBDatabase) {
|
||||
window.idb = db;
|
||||
}
|
||||
const db = IDBManager.loadIDB("AluDB", 1);
|
||||
db.onupgradeneeded = () => {
|
||||
window.idb = db.result;
|
||||
IDBManager.SetIDB(window.idb);
|
||||
IDBManager.CreateStore("InstalledExtensions", { keyPath: "slug" });
|
||||
};
|
||||
db.onsuccess = () => {
|
||||
window.idb = db.result;
|
||||
IDBManager.SetIDB(window.idb);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue