UNPKG

@edonec/indexed-db-class

Version:

An easy to use IndexedDb class, (post,put,delete and get) data easily from your indexedDb storage

18 lines (17 loc) 887 B
interface IObjectStore { tableName: string; key: string; } export declare class IndexedDb { private dbName; private tableList; private dbVersion; constructor(dbName: string, tablesList: IObjectStore[], dbVersion?: number); readonly createTable: (tableName: string, keyPath: string) => Promise<void>; readonly postData: (tableName: string, objectToAdd: Record<string, unknown>, mode?: IDBTransactionMode) => Promise<void>; readonly deleteData: (tableName: string, id: string) => void; readonly getData: <T = any>(storeName: string, id: string) => Promise<T>; readonly updateData: (tableName: string, newData: Record<string, unknown>, mode?: IDBTransactionMode) => Promise<void>; readonly createOrUpdate: (tableName: string, objectToUpdate: Record<string, unknown>, mode?: IDBTransactionMode) => Promise<void>; } export {};