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:
24
public/background.js
Normal file
24
public/background.js
Normal 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})
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user