idb-keyval
Advanced tools
Comparing version 5.0.0 to 5.0.1
export declare function promisifyRequest<T = undefined>(request: IDBRequest<T> | IDBTransaction): Promise<T>; | ||
export declare function createStore(dbName: string, storeName: string): UseStore; | ||
export declare type UseStore = <T>(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T) => T extends PromiseLike<any> ? T : Promise<T>; | ||
export declare type UseStore = <T>(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T | PromiseLike<T>) => Promise<T>; | ||
/** | ||
@@ -5,0 +5,0 @@ * Get a value by its key. |
@@ -30,7 +30,5 @@ 'use strict'; | ||
return function (txMode, callback) { | ||
return (// TODO: I'm not sure why I have to cast to any here. Maybe some TypeScript expert can help? | ||
dbp.then(function (db) { | ||
return callback(db.transaction(storeName, txMode).objectStore(storeName)); | ||
}) | ||
); | ||
return dbp.then(function (db) { | ||
return callback(db.transaction(storeName, txMode).objectStore(storeName)); | ||
}); | ||
}; | ||
@@ -37,0 +35,0 @@ } |
export declare function promisifyRequest<T = undefined>(request: IDBRequest<T> | IDBTransaction): Promise<T>; | ||
export declare function createStore(dbName: string, storeName: string): UseStore; | ||
export declare type UseStore = <T>(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T) => T extends PromiseLike<any> ? T : Promise<T>; | ||
export declare type UseStore = <T>(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T | PromiseLike<T>) => Promise<T>; | ||
/** | ||
@@ -5,0 +5,0 @@ * Get a value by its key. |
@@ -17,5 +17,3 @@ 'use strict'; | ||
const dbp = promisifyRequest(request); | ||
return (txMode, callback) => | ||
// TODO: I'm not sure why I have to cast to any here. Maybe some TypeScript expert can help? | ||
dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName))); | ||
return (txMode, callback) => dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName))); | ||
} | ||
@@ -22,0 +20,0 @@ let defaultGetStoreFunc; |
export declare function promisifyRequest<T = undefined>(request: IDBRequest<T> | IDBTransaction): Promise<T>; | ||
export declare function createStore(dbName: string, storeName: string): UseStore; | ||
export declare type UseStore = <T>(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T) => T extends PromiseLike<any> ? T : Promise<T>; | ||
export declare type UseStore = <T>(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T | PromiseLike<T>) => Promise<T>; | ||
/** | ||
@@ -5,0 +5,0 @@ * Get a value by its key. |
@@ -24,7 +24,5 @@ function promisifyRequest(request) { | ||
return function (txMode, callback) { | ||
return (// TODO: I'm not sure why I have to cast to any here. Maybe some TypeScript expert can help? | ||
dbp.then(function (db) { | ||
return callback(db.transaction(storeName, txMode).objectStore(storeName)); | ||
}) | ||
); | ||
return dbp.then(function (db) { | ||
return callback(db.transaction(storeName, txMode).objectStore(storeName)); | ||
}); | ||
}; | ||
@@ -31,0 +29,0 @@ } |
export declare function promisifyRequest<T = undefined>(request: IDBRequest<T> | IDBTransaction): Promise<T>; | ||
export declare function createStore(dbName: string, storeName: string): UseStore; | ||
export declare type UseStore = <T>(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T) => T extends PromiseLike<any> ? T : Promise<T>; | ||
export declare type UseStore = <T>(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T | PromiseLike<T>) => Promise<T>; | ||
/** | ||
@@ -5,0 +5,0 @@ * Get a value by its key. |
@@ -13,5 +13,3 @@ function promisifyRequest(request) { | ||
const dbp = promisifyRequest(request); | ||
return (txMode, callback) => | ||
// TODO: I'm not sure why I have to cast to any here. Maybe some TypeScript expert can help? | ||
dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName))); | ||
return (txMode, callback) => dbp.then((db) => callback(db.transaction(storeName, txMode).objectStore(storeName))); | ||
} | ||
@@ -18,0 +16,0 @@ let defaultGetStoreFunc; |
{ | ||
"name": "idb-keyval", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "A super-simple-small keyval store built on top of IndexedDB", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs-compat/index.js", |
@@ -18,6 +18,5 @@ export function promisifyRequest<T = undefined>( | ||
return (txMode, callback) => | ||
// TODO: I'm not sure why I have to cast to any here. Maybe some TypeScript expert can help? | ||
dbp.then((db) => | ||
callback(db.transaction(storeName, txMode).objectStore(storeName)), | ||
) as any; | ||
); | ||
} | ||
@@ -27,4 +26,4 @@ | ||
txMode: IDBTransactionMode, | ||
callback: (store: IDBObjectStore) => T, | ||
) => T extends PromiseLike<any> ? T : Promise<T>; | ||
callback: (store: IDBObjectStore) => T | PromiseLike<T>, | ||
) => Promise<T>; | ||
@@ -31,0 +30,0 @@ let defaultGetStoreFunc: UseStore | undefined; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110048
1949