@@ -31,29 +31,22 @@ class IDBDatabaseHelper {
3131
3232 public clearObjectStore = ( tx : IDBTransaction ) : Promise < boolean > => (
3333 new Promise < boolean > ( async ( resolve , _ ) => {
34- // eslint-disable-next-line no-param-reassign
35- tx . oncomplete = ( ) => resolve ( true ) ;
36- // eslint-disable-next-line no-param-reassign
37- tx . onerror = ( err ) => {
38- console . log ( err ) ;
39- return resolve ( false ) ;
40- } ;
4134 const objectStore = tx . objectStore ( 'data' ) ;
4235 const storeAction = objectStore . clear ( ) ;
43- storeAction . onsuccess = ( ) => { } ;
36+ storeAction . onsuccess = ( ) => {
37+ resolve ( true ) ;
38+ } ;
4439 storeAction . onerror = ( ) => resolve ( false ) ;
4540 } )
4641 )
4742
4843 public save = ( tx : IDBTransaction , uuid : string , data : any ) : Promise < string > => new Promise < string > ( async ( resolve , reject ) => {
4944 try {
50- // eslint-disable-next-line no-param-reassign
51- tx . oncomplete = ( ) => resolve ( uuid ) ;
52- // eslint-disable-next-line no-param-reassign
53- tx . onerror = ( err ) => console . log ( err ) ;
5445 const objectStore = tx . objectStore ( 'data' ) ;
5546 const storeAction = objectStore . put ( JSON . stringify ( data ) , uuid ) ;
56- storeAction . onsuccess = ( ) => { } ;
47+ storeAction . onsuccess = ( ) => {
48+ resolve ( uuid ) ;
49+ } ;
5750 storeAction . onerror = ( evt : Event ) => reject ( evt ) ;
5851 } catch ( err ) {
5952 reject ( err ) ;
@@ -62,10 +55,6 @@ class IDBDatabaseHelper {
6255
6356 public retrieve = ( tx : IDBTransaction , uuid : string ) : Promise < any > => new Promise < any > ( async ( resolve , reject ) => {
6457 try {
65- // eslint-disable-next-line no-param-reassign
66- tx . oncomplete = ( ) => resolve ( uuid ) ;
67- // eslint-disable-next-line no-param-reassign
68- tx . onerror = ( err ) => console . log ( err ) ;
6958 const objectStore = tx . objectStore ( 'data' ) ;
7059 const storeAction = objectStore . get ( uuid ) ;
7160 storeAction . onsuccess = ( evt : Event ) => {
@@ -85,13 +74,11 @@ class IDBDatabaseHelper {
8574
8675 public delete = ( tx : IDBTransaction , uuid : string ) : Promise < string > => new Promise < string > ( async ( resolve , reject ) => {
8776 try {
88- // eslint-disable-next-line no-param-reassign
89- tx . oncomplete = ( ) => resolve ( uuid ) ;
90- // eslint-disable-next-line no-param-reassign
91- tx . onerror = ( err ) => console . log ( err ) ;
9277 const objectStore = tx . objectStore ( 'data' ) ;
9378 const storeAction = objectStore . delete ( uuid ) ;
94- storeAction . onsuccess = ( ) => { } ;
79+ storeAction . onsuccess = ( ) => {
80+ resolve ( uuid ) ;
81+ } ;
9582 storeAction . onerror = ( evt : Event ) => reject ( evt ) ;
9683 } catch ( err ) {
9784 reject ( err ) ;
0 commit comments