import { useState, useEffect } from 'react' import { Box, Button, Select } from 'theme-ui' import getWebRTCData from './getWebRTCData' import handleWebRtcPolicy from './handleWebRtcPolicy' interface LocationPageProps { tab: string } const WebRtcPage = ({ tab }: LocationPageProps) => { const [webRtcPolicy, setWebRtcPolicy] = useState('default') const [webRtcIp, setWebRtcIp] = useState([]) useEffect(() => { chrome.storage.local.get(['webRtcPolicy'], (storage) => { storage.webRtcPolicy && setWebRtcPolicy(storage.webRtcPolicy) }) }, []) chrome.privacy.network.webRTCIPHandlingPolicy.onChange.addListener(function ( details ) { console.log(details) setWebRtcPolicy(details.value) }) return ( WebRTC Policy IP: {JSON.stringify(webRtcIp)} ) } export default WebRtcPage