@creasource/reactive-idb
Version:
A reactive wrapper to indexedDb using Rxjs
41 lines (40 loc) • 2.11 kB
TypeScript
import { Observable } from 'rxjs';
import { ReactiveIDBDatabase, ReactiveIDBTransformer } from './reactive-idb-database';
import { ReactiveIDBObjectStore } from './reactive-idb-object-store';
export declare class ReactiveIDBTransaction {
private readonly transaction;
readonly db: ReactiveIDBDatabase;
/**
* If the transaction was aborted, returns the error (a DOMException) providing the reason.
*/
get error(): DOMException | null;
/**
* Returns the mode the transaction was created with ("readonly" or "readwrite"), or "versionchange" for an upgrade transaction.
*/
get mode(): IDBTransactionMode;
/**
* Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database.
*/
get objectStoreNames(): DOMStringList;
/**
* Constructs a ReactiveIDBTransaction
*
* @param transaction The underlying IDBTransaction object
* @param db The associated ReactiveIDBDatabase of this transaction
*/
constructor(transaction: IDBTransaction, db: ReactiveIDBDatabase);
/**
* Aborts the transaction. All pending requests will fail with a "AbortError" DOMException and all changes made to the database will be reverted.
*/
abort(): void;
/**
* Returns a ReactiveIDBObjectStore in the transaction's scope.
*/
objectStore<T = unknown>(name: string, transformer?: ReactiveIDBTransformer<T>): ReactiveIDBObjectStore<T>;
/**
* Returns a ReactiveIDBObjectStore in the transaction's scope.
*/
objectStore$<T = unknown>(name: string, transformer?: ReactiveIDBTransformer<T>): Observable<ReactiveIDBObjectStore<T>>;
addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => void, options?: boolean | EventListenerOptions): void;
}