How does chrome.devtools.panels.sources.onSelectionChanged work?

I am making an extension for Google Chrome DevTools and am having a problem with an event chrome.devtools.panels.sources.onSelectionChanged

that just won't be called. Here's a sample from my code devtools_page

:

chrome.devtools.panels.sources.createSidebarPane(pluginTitle, function(sidebar) {
  sidebar.setPage("pane.html");

  var port = chrome.runtime.connect({name: 'devtools'});

  port.postMessage({log: 'devtools init'});

  chrome.devtools.panels.sources.onSelectionChanged.addListener(function() {
      port.postMessage({
        log: 'Selection changed'
      });
  });

  port.postMessage({log: 'devtools inited'});
});

      

I get both "devtools init" and "devtools inited" messages (just to make sure it doesn't crash somewhere), but I never get the "Change changed" message.

Am I missing something? What exactly should you react to sources.onSelectionChanged

? Do I have enough permissions? My current permissions:

[
  "tabs",
  "nativeMessaging",
  "webNavigation",
  "webRequestBlocking",
  "webRequest",
  "*://*/*"
]

      

+3


source to share





All Articles