ngx-indexed-db
ngx-indexed-db copied to clipboard
Readme for cursor api is not valid
This block of code is not compatible with current version
db.openCursor('people', (evt) => {
var cursor = (<any>evt.target).result;
if(cursor) {
console.log(cursor.value);
cursor.continue();
} else {
console.log('Entries all displayed.');
}
}, IDBKeyRange.bound("A", "F"));
as I can see in source code, typings is copletely incompatible
/**
* Returns the open cursor event
* @param storeName The name of the store to have the entries deleted
* @param keyRange The key range which the cursor should be open on
*/
openCursor(storeName: string, keyRange?: IDBKeyRange): Observable<Event>;
Can you please update it? Now I am unable to iterate over your api ...
I have already found some solution, but it is probably too complicated and wrong ...
this.dbService.openCursor('table-name').subscribe((evt: any) => {
const cursor: IDBCursorWithValue = evt.target.result;
if (cursor) {
console.log(cursor.value);
cursor.continue();
} else {
console.log('Entries all displayed.');
}
const target: IDBRequest = evt.target;
target.onsuccess = (): void => {
const cursor: IDBCursorWithValue = evt.target.result;
if (cursor) {
console.log(cursor.value);
cursor.continue();
} else {
console.log('Entries all displayed.');
}
};
});