diff options
author | Indrajith K L | 2019-07-12 19:59:42 +0530 |
---|---|---|
committer | Indrajith K L | 2019-07-12 19:59:42 +0530 |
commit | fa8316a94c092e986b4b2616f1992ee2a3eec01a (patch) | |
tree | 94a425f0ec03570f815274ba1039ce2951578e77 /public/background.js | |
parent | 481bbb5a2271c521265dd20280324435854dbb12 (diff) | |
download | bookmark-manager-fa8316a94c092e986b4b2616f1992ee2a3eec01a.tar.gz bookmark-manager-fa8316a94c092e986b4b2616f1992ee2a3eec01a.tar.bz2 bookmark-manager-fa8316a94c092e986b4b2616f1992ee2a3eec01a.zip |
Initial Commit
:tada:
* Adds Manifest for Extension
* Adds barebone messaging from extension and front-end
* Adds .env to run react app under CSP
Diffstat (limited to 'public/background.js')
-rw-r--r-- | public/background.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/public/background.js b/public/background.js new file mode 100644 index 0000000..f94c039 --- /dev/null +++ b/public/background.js @@ -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}) + }); + +}
\ No newline at end of file |