Initial Commit

🎉
* Adds Manifest for Extension
* Adds barebone messaging from extension and front-end
* Adds .env to run react app under CSP
This commit is contained in:
Indrajith K L
2019-07-12 19:59:42 +05:30
parent 481bbb5a22
commit fa8316a94c
11 changed files with 190 additions and 94 deletions

24
public/background.js Normal file
View File

@@ -0,0 +1,24 @@
chrome.browserAction.onClicked.addListener( (tab) =>{
chrome.tabs.create({ 'url': chrome.extension.getURL('index.html') }, (tab) => {
});
});
chrome.runtime.onConnect.addListener(port => {
port.onMessage.addListener(message => {
/* Perform an action if the message meets our criteria */
if (message.code === "getBookMarks") {
getBookMarks(port)
}
})
});
getBookMarks = (port) => {
chrome.bookmarks.getTree(function (data) {
port.postMessage({ bookMarkData: data})
});
}