Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
onCommand.addListener no funciona en mi extensión de Chrome

Actualmente estoy desarrollando una extensión de Chrome, solo que tengo un problema ya que onCommand.addListener no funciona en mi archivo background.js . Mi archivo manifest.json se ve así:

 { "manifest_version": 3, "name": "Copy", "version": "1.0.0", "permissions": [ "storage", "activeTab", "scripting" ], "background": { "service_worker": "js/background.js" }, "commands": { "run-foo": { "suggested_key": { "default": "Ctrl+Shift+Y", "mac": "Command+Shift+Y" }, "description": "Run \"foo\" on the current page." }, "_execute_action": { "suggested_key": { "windows": "Ctrl+Shift+Y", "mac": "Command+Shift+Y", "chromeos": "Ctrl+Shift+U", "linux": "Ctrl+Shift+J" } } } }

Y mi archivo background.js en la carpeta js se ve así:

 console.log('test'); chrome.commands.onCommand.addListener(function(command){ if(command === 'run-foo'){ sendResponse({data: window.getSelection().toString()}); console.log('copié !!!'); let copieText = 'je suis le texte copié'; } }); chrome.commands.onCommand.addListener(function(command) { console.log('onCommand event received for message: ', command); });

Pero mi consola solo devuelve la prueba, incluso si presiono Ctrl-C varias veces.

Gracias de antemano

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!