forked from MapComplete/MapComplete
Fix build
This commit is contained in:
parent
827d9ae685
commit
55a313c2aa
1 changed files with 13 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue