* Load history from localStorage * @param {string} key Storage key * @returns {Array } History items
(key)
| 21 | * @returns {Array<string>} History items |
| 22 | */ |
| 23 | loadHistory(key) { |
| 24 | try { |
| 25 | const stored = localStorage.getItem(key); |
| 26 | return stored ? JSON.parse(stored) : []; |
| 27 | } catch (error) { |
| 28 | console.warn("Failed to load search history:", error); |
| 29 | return []; |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Save history to localStorage |