switch to a library with ts support out of the box, idb

This commit is contained in:
Jack Case
2025-12-10 20:15:50 +00:00
parent f71467fdf8
commit dbe14c9b25
7 changed files with 24 additions and 26 deletions

3
src/@custom_types/indexeddb.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
declare class Database {
constructor(name: string, version: number)
}

View File

@@ -1,7 +1,4 @@
// import { } from "./common.js"
import { Database } from "indexeddb-promise/indexeddb.js"
const db = new Database("asdf", 1)
import { openDB, IDBPDatabase } from "/idb/index.js"
export class IDBCursorValueIterator {
cursor: IDBCursorWithValue
@@ -39,11 +36,17 @@ export class IDBCursorValueIterator {
export class SlopDB {
open_promise: Promise<IDBDatabase>
db: IDBDatabase
version: number
open_promise: Promise<IDBPDatabase>
db: IDBPDatabase
constructor(idb_version: number) {
this.open_promise = this.open_database(idb_version)
this.version = idb_version
this.open_promise = openDB("SlopDB", idb_version, {
upgrade(db, oldVersion, newVersion, transaction, event) {
//TODO
}
})
}
async db_opened() {