| 104 | }; |
| 105 | |
| 106 | const storeFileHandleInIDB = async (handle) => { |
| 107 | try { |
| 108 | performance.mark('start-file-handle-cache'); |
| 109 | await set('model.bin.handle', handle); |
| 110 | performance.mark('end-file-handle-cache'); |
| 111 | const mark = performance.measure( |
| 112 | 'file-handle-cache', |
| 113 | 'start-file-handle-cache', |
| 114 | 'end-file-handle-cache' |
| 115 | ); |
| 116 | console.log( |
| 117 | 'Model file handle cached in IDB.', |
| 118 | mark.name, |
| 119 | mark.duration.toFixed(2) |
| 120 | ); |
| 121 | } catch (err) { |
| 122 | console.error(err.name, err.message); |
| 123 | } |
| 124 | }; |
| 125 | |
| 126 | const restoreFileFromIDB = async () => { |
| 127 | try { |