diff --git a/components/RoutePersistence.tsx b/components/RoutePersistence.tsx index a765ec9..318282b 100644 --- a/components/RoutePersistence.tsx +++ b/components/RoutePersistence.tsx @@ -1,6 +1,6 @@ import { useEffect, useRef } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; -import { storage } from '@/utils/chromeStorage'; +import { storageUtil } from '@/utils/chromeStorage'; const RoutePersistence = () => { const location = useLocation(); @@ -13,7 +13,7 @@ const RoutePersistence = () => { if (isRestored.current) return; try { - const lastRoute = await storage.get('app/lastRoute'); + const lastRoute = await storageUtil.get('app/lastRoute'); if (lastRoute && lastRoute !== '/' && location.pathname === '/') { navigate(lastRoute, { replace: true }); @@ -32,7 +32,7 @@ const RoutePersistence = () => { useEffect(() => { const saveRoute = async () => { if (!isRestored.current) return; - await storage.set('app/lastRoute', location.pathname); + await storageUtil.set('app/lastRoute', location.pathname); console.log('保存路由', location.pathname); }; diff --git a/utils/chromeStorage.ts b/utils/chromeStorage.ts index be0ce2c..ae1154b 100644 --- a/utils/chromeStorage.ts +++ b/utils/chromeStorage.ts @@ -40,4 +40,4 @@ class StorageUtils { } } -export const storage = new StorageUtils(); +export const storageUtil = new StorageUtils(); diff --git a/utils/recordUtils.tsx b/utils/recordUtils.tsx index b308575..08be169 100644 --- a/utils/recordUtils.tsx +++ b/utils/recordUtils.tsx @@ -55,11 +55,13 @@ export const downloadHtmlInBackground = (events: unknown[]) => { const blob = new Blob([htmlContent], { type: 'text/html' }); const reader = new FileReader(); reader.onload = () => { - chrome.downloads.download({ - url: reader.result as string, - filename: `replay-${Date.now()}.html`, - saveAs: true, - }).then(r => console.log(r)); + chrome.downloads + .download({ + url: reader.result as string, + filename: `replay-${Date.now()}.html`, + saveAs: true, + }) + .then((r) => console.log(r)); }; reader.readAsDataURL(blob); };