mirror of
https://github.com/abhijithvijayan/web-extension-starter.git
synced 2025-10-07 07:22:37 +02:00
refactor: ts rewrite content script & background script
This commit is contained in:
parent
b3ddb80e99
commit
7070a49f7c
1
src/Background/index.ts
Normal file
1
src/Background/index.ts
Normal file
@ -0,0 +1 @@
|
||||
console.log('this is background scripts file');
|
||||
@ -1,14 +0,0 @@
|
||||
import browser from 'webextension-polyfill';
|
||||
|
||||
browser.runtime.onInstalled.addListener(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('onInstalled....');
|
||||
});
|
||||
|
||||
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
// Do something with the message!
|
||||
alert(request.url);
|
||||
|
||||
// And respond back to the sender.
|
||||
return Promise.resolve('got your message, thanks!');
|
||||
});
|
||||
@ -52,8 +52,8 @@ module.exports = {
|
||||
mode: nodeEnv,
|
||||
|
||||
entry: {
|
||||
background: './src/scripts/background.js',
|
||||
contentScript: './src/scripts/contentScript.js',
|
||||
background: path.join(sourcePath, 'Background', 'index.ts'),
|
||||
contentScript: path.join(sourcePath, 'ContentScript', 'index.ts'),
|
||||
popup: './src/scripts/popup.js',
|
||||
options: './src/scripts/options.js',
|
||||
styles: [path.join(sourcePath, 'Popup', 'popup.scss'), path.join(sourcePath, 'Options', 'options.scss')],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user