(key, callback)
| 34 | } |
| 35 | |
| 36 | function removeFavorite(key, callback) { |
| 37 | queryDB((db) => { |
| 38 | let transaction = db.transaction(['favorites'], 'readwrite'); |
| 39 | let favoritesStore = transaction.objectStore('favorites'); |
| 40 | let removeFavoriteRequest = favoritesStore.delete(key); |
| 41 | |
| 42 | removeFavoriteRequest.onerror = function(event) { |
| 43 | console.log(`Could not remove favorite with key: ${key}`); |
| 44 | console.log(event.target.error.message); |
| 45 | }; |
| 46 | |
| 47 | removeFavoriteRequest.onsuccess = function(event) { |
| 48 | if (callback) { |
| 49 | callback(); |
| 50 | } |
| 51 | }; |
| 52 | }); |
| 53 | } |
| 54 | |
| 55 | function getFavoritesAsJson(callback) { |
| 56 | queryDB((db) => { |
no test coverage detected