git.iko.soy/purescript-indexed-DB
on master help sign in
finalize implementation of cursor.source
commitcba6b08b7a677aa93f51400a40828a5744917e8e authorKtorZ <matthias.benkort@gmail.com> dateFri 30 Jun 2017, 22:51 (9 years ago) parentc958e2d
1 file changed+8−4
src/Database/IndexedDB/IDBCursor.js+8−4
src/Database/IndexedDB/IDBCursor.js+8−4
@@ -67,10 +67,14 @@ exports._primaryKey = function _primaryKey(cursor) {
6767};
6868
6969exports._source = function _source(IDBObjectStore, IDBIndex, cursor) {
70− console.log(typeof cursor.source);
71− console.log(Object.getPrototypeOf(cursor.source));
72− console.log(cursor.source);
73− throw new Error('TODO');
70+ switch (cursor.source.constructor.name) {
71+ case 'IDBIndex':
72+ return IDBIndex(cursor.source);
73+ case 'IDBObjectStore':
74+ return IDBObjectStore(cursor.source);
75+ default:
76+ throw new Error('UnexpectedCursorSource');
77+ }
7478};
7579
7680exports._update = function _update(cursor, value) {