Hi there I am trying to undestand how Event Pages work for Chrome extensions. The idea is to ask for the event page to get the bookmarks tree and send it as a response to the popup.
The problem: The response is undefined. The response from the outside of the getTree() function works, the other does not. Am I doing this the wrong way ?
background.js
chrome.runtime.onMessage.addListener(
 function(request, sender, sendResponse) {
   if (request.action == "INIT"){
     chrome.bookmarks.getTree( function( treeStructure ){
       sendResponse(treeStructure);
     });
    }
   //sendResponse(true);
});
popup.js
chrome.runtime.sendMessage({action: "INIT"}, function(response) {
  console.log(response);
});
manifest.xml
{
    "manifest_version": 2,
    "name": "Test",
    "description": "Test",
    "version": "1.0",
    "browser_action": {
        "default_icon": "/img/icon.png",
        "default_popup": "front.html"
    },
    "icons": { "16": "/img/icon.png",
           "48": "/img/icon.png",
          "128": "/img/icon.png" },
    "permissions": [
        "bookmarks",
        "storage",
        "https://*/"
    ],
    "background": {
        "scripts": ["js/back.js"],
        "persistent": false
    }
}
 
    