Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/pages/Background/index.js
Original file line number Diff line number Diff line change
@@ -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" });

}
2 changes: 2 additions & 0 deletions src/pages/Content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
13 changes: 13 additions & 0 deletions src/pages/Popup/Popup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="App">
<header className="App-header">
Expand All @@ -14,6 +24,9 @@ const Popup = () => {
<Text fontSize='20px' color='tomato'>
PLANES
</Text>

<input value={name} onChange={e => setName(e.target.value)} />
<button onClick={handleClick}>Click me</button>
<a
className="App-link"
href="https://reactjs.org"
Expand Down