Emoji favicons for the web
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix linting

+12 -9
+12 -9
source/popup.tsx
··· 4 4 import { useCallback, useEffect, useState } from 'preact/hooks'; 5 5 import browserAPI from './utilities/browser_api.ts'; 6 6 7 + interface Tab { 8 + favIconUrl?: string; 9 + url?: string; 10 + } 11 + 7 12 const App = () => { 8 - const [ url, setUrl ] = useState(""); 13 + const [url, setUrl] = useState<string | void>(); 9 14 10 15 useEffect(() => { 11 - browserAPI.tabs.query({active: true}) 12 - .then(([currTab]: any) => { 16 + browserAPI.tabs.query({ active: true }) 17 + .then(([currTab]: Tab[]) => { 13 18 setUrl(currTab.favIconUrl); 14 19 }); 15 20 }, []); ··· 19 24 }, []); 20 25 21 26 const addToOverrides = useCallback(() => { 22 - browserAPI.tabs.query({active: true}) 23 - .then(([currTab]: any) => { 27 + browserAPI.tabs.query({ active: true }) 28 + .then(([currTab]: Tab[]) => { 24 29 setUrl(currTab.url); 25 30 }); 26 - }, []) 27 - 31 + }, []); 28 32 29 33 return ( 30 34 <div className='page'> ··· 36 40 <button onClick={addToOverrides}> 37 41 Change Favicon 38 42 </button> 39 - <div>{url}</div> 43 + <div>{url || ''}</div> 40 44 </div> 41 45 ); 42 46 }; 43 - 44 47 45 48 const mountPoint = document.getElementById('mount'); 46 49 if (mountPoint) render(<App />, mountPoint);