Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wrap-idb-value.d.ts 1.5KB

12345678910111213141516171819202122232425262728293031323334
  1. import { IDBPCursor, IDBPCursorWithValue, IDBPDatabase, IDBPIndex, IDBPObjectStore, IDBPTransaction } from './entry';
  2. export declare const reverseTransformCache: WeakMap<object, any>;
  3. export declare function replaceTraps(callback: (currentTraps: ProxyHandler<any>) => ProxyHandler<any>): void;
  4. /**
  5. * Enhance an IDB object with helpers.
  6. *
  7. * @param value The thing to enhance.
  8. */
  9. export declare function wrap(value: IDBDatabase): IDBPDatabase;
  10. export declare function wrap(value: IDBIndex): IDBPIndex;
  11. export declare function wrap(value: IDBObjectStore): IDBPObjectStore;
  12. export declare function wrap(value: IDBTransaction): IDBPTransaction;
  13. export declare function wrap(value: IDBOpenDBRequest): Promise<IDBPDatabase | undefined>;
  14. export declare function wrap<T>(value: IDBRequest<T>): Promise<T>;
  15. /**
  16. * Revert an enhanced IDB object to a plain old miserable IDB one.
  17. *
  18. * Will also revert a promise back to an IDBRequest.
  19. *
  20. * @param value The enhanced object to revert.
  21. */
  22. interface Unwrap {
  23. (value: IDBPCursorWithValue<any, any, any, any, any>): IDBCursorWithValue;
  24. (value: IDBPCursor<any, any, any, any, any>): IDBCursor;
  25. (value: IDBPDatabase): IDBDatabase;
  26. (value: IDBPIndex<any, any, any, any, any>): IDBIndex;
  27. (value: IDBPObjectStore<any, any, any, any>): IDBObjectStore;
  28. (value: IDBPTransaction<any, any, any>): IDBTransaction;
  29. <T extends any>(value: Promise<IDBPDatabase<T>>): IDBOpenDBRequest;
  30. (value: Promise<IDBPDatabase>): IDBOpenDBRequest;
  31. <T>(value: Promise<T>): IDBRequest<T>;
  32. }
  33. export declare const unwrap: Unwrap;
  34. export {};