mirror of
https://github.com/abhijithvijayan/web-extension-starter.git
synced 2026-03-20 01:37:46 +01: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,
|
mode: nodeEnv,
|
||||||
|
|
||||||
entry: {
|
entry: {
|
||||||
background: './src/scripts/background.js',
|
background: path.join(sourcePath, 'Background', 'index.ts'),
|
||||||
contentScript: './src/scripts/contentScript.js',
|
contentScript: path.join(sourcePath, 'ContentScript', 'index.ts'),
|
||||||
popup: './src/scripts/popup.js',
|
popup: './src/scripts/popup.js',
|
||||||
options: './src/scripts/options.js',
|
options: './src/scripts/options.js',
|
||||||
styles: [path.join(sourcePath, 'Popup', 'popup.scss'), path.join(sourcePath, 'Options', 'options.scss')],
|
styles: [path.join(sourcePath, 'Popup', 'popup.scss'), path.join(sourcePath, 'Options', 'options.scss')],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user