diff --git a/src/pages/Background/index.js b/src/pages/Background/index.js index 8943b846f..b57ba9949 100644 --- a/src/pages/Background/index.js +++ b/src/pages/Background/index.js @@ -1,2 +1,11 @@ console.log('This is the background page.'); console.log('Put the background scripts here.'); + + +chrome.runtime.onMessage.addListener(messageReceived); + +function messageReceived(msg, sender, sendResponse) { + console.log('inside the background paghe', msg, sender, sendResponse) + return sendResponse({ farewell: "goodbye" }); + +} \ No newline at end of file diff --git a/src/pages/Content/index.js b/src/pages/Content/index.js index d9e44cee1..558b648de 100644 --- a/src/pages/Content/index.js +++ b/src/pages/Content/index.js @@ -3,4 +3,6 @@ import { printLine } from './modules/print'; console.log('Content script works!'); console.log('Must reload extension for modifications to take effect.'); + + printLine("Using the 'printLine' function from the Print Module"); diff --git a/src/pages/Popup/Popup.jsx b/src/pages/Popup/Popup.jsx index df1684b13..bb7359827 100644 --- a/src/pages/Popup/Popup.jsx +++ b/src/pages/Popup/Popup.jsx @@ -4,6 +4,16 @@ import './Popup.css'; import { Text } from '@chakra-ui/react' const Popup = () => { + const [name, setName] = React.useState(''); + + const handleClick = () => { + console.log('handleClick function!',); + + chrome.runtime.sendMessage('{ greeting: name }', function (response) { + console.log('response in popup click handler', response); + }); + + } return (