@@ -47,20 +47,17 @@ function openDB(name = "search-cache", version = 1) {
47
47
*/
48
48
async function getFromIDB ( key ) {
49
49
const db = await openDB ( ) ;
50
- console . log ( `Retrieving from IndexedDB with key: ${ key } ` ) ;
51
50
52
51
return new Promise ( ( resolve , reject ) => {
53
52
const transaction = db . transaction ( "indexes" , "readonly" ) ;
54
53
const store = transaction . objectStore ( "indexes" ) ;
55
54
const request = store . get ( key ) ;
56
55
57
56
request . onsuccess = ( ) => {
58
- console . log ( "Retrieved from IndexedDB:" , request . result ) ;
59
57
resolve ( request . result ) ;
60
58
} ;
61
59
62
60
request . onerror = ( ) => {
63
- console . error ( "Failed to retrieve from IndexedDB:" , request . error ) ;
64
61
reject ( request . error ) ;
65
62
} ;
66
63
} ) ;
@@ -74,15 +71,13 @@ async function getFromIDB(key) {
74
71
*/
75
72
async function saveToIDB ( key , value ) {
76
73
const db = await openDB ( ) ;
77
- console . log ( `Saving to IndexedDB with key: ${ key } ` , value ) ;
78
74
79
75
return new Promise ( ( resolve , reject ) => {
80
76
const transaction = db . transaction ( "indexes" , "readwrite" ) ;
81
77
const store = transaction . objectStore ( "indexes" ) ;
82
78
const request = store . put ( value , key ) ;
83
79
84
80
request . onsuccess = ( ) => {
85
- console . log ( "Saved to IndexedDB successfully" ) ;
86
81
resolve ( true ) ;
87
82
} ;
88
83
@@ -136,8 +131,8 @@ require(["fuse"], function (Fuse) {
136
131
137
132
if ( ! libData ) {
138
133
const libPath = EXTRA_SOURCES [ lib ] ;
139
- const libJsonPath = `${ libPath } /_static/search.json` ;
140
- const res = await fetch ( libJsonPath ) ;
134
+ const url = `${ libPath } /_static/search.json` ;
135
+ const res = await fetch ( url ) ;
141
136
libData = await res . json ( ) ;
142
137
await saveToIDB ( cacheKey , libData ) ;
143
138
}
@@ -464,7 +459,6 @@ require(["fuse"], function (Fuse) {
464
459
const handleSearchInput = debounce (
465
460
( ) => {
466
461
const query = document . getElementById ( "search-input" ) . value . trim ( ) ;
467
- console . log ( "Search query:" , query ) ;
468
462
if ( query . length > 0 ) {
469
463
performSearch ( ) ;
470
464
}
0 commit comments