Fix build

This commit is contained in:
Pieter Vander Vennet 2025-08-01 18:25:00 +02:00
parent 827d9ae685
commit 55a313c2aa

View file

@ -3,6 +3,7 @@ import { RequestParameters } from "maplibre-gl"
import { IsOnline } from "./Web/IsOnline"
import Constants from "../Models/Constants"
import { Store, UIEventSource } from "./UIEventSource"
import { Utils } from "../Utils"
export interface AreaDescription {
@ -47,6 +48,9 @@ class TypedIdb<T> {
}
private static openDb(name: string): Promise<IDBDatabase> {
if (Utils.runningFromConsole) {
return Promise.resolve(undefined)
}
return new Promise((resolve, reject) => {
const request: IDBOpenDBRequest = indexedDB.open(name)
@ -66,6 +70,9 @@ class TypedIdb<T> {
async set(key: string, value: T): Promise<void> {
if (Utils.runningFromConsole) {
return Promise.resolve()
}
const db = await this._db
return new Promise((resolve, reject) => {
const tx = db.transaction([this._name], "readwrite")
@ -78,6 +85,9 @@ class TypedIdb<T> {
}
async get(key: string): Promise<T> {
if (Utils.runningFromConsole) {
return Promise.resolve(undefined)
}
const db = await this._db
return new Promise((resolve, reject) => {
const tx = db.transaction([this._name], "readonly")
@ -90,6 +100,9 @@ class TypedIdb<T> {
}
async getAllValues(): Promise<T[]> {
if (Utils.runningFromConsole) {
return Promise.resolve([])
}
const db = await this._db
return new Promise((resolve, reject) => {
const tx = db.transaction([this._name], "readonly")