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

274
Views
falla de fondo a primer plano chrome.runtime.onMessage()

Verifique el código de extensión de Google Chrome a continuación. Aquí simplemente estoy tratando de enviar un mensaje de cadena básico de fondo a primer plano, pero recibo un error en la consola de pestañas: Error in event handler: TypeError: Error in invocation of tabs.sendMessage(integer tabId, any message, optional object options, optional function callback): No matching signature. ¿Qué hay de malo que estoy haciendo aquí alguna idea?

manifiesto.json:

 { "name": "obj ext", "description": "my ext", "version": "0.1.0", "manifest_version": 2, "icons": { "16": "./obj-16x16.png", "32": "./obj-32x32.png", "48": "./obj-48x48.png", "128": "./obj-128x128.png" }, "background":{ "scripts":["./background.js"] }, "options_page":"./options.html", "browser_action":{ "default_popup": "popup.html" }, "permissions":[ "tabs", "https://www.google.com/" ] }

fondo.js:

 chrome.tabs.onActivated.addListener(tab => { console.log(tab.tabId); chrome.tabs.sendMessage( {tabId: tab.tabId}, {message: 'Hello'} ); });

primer plano.js

 chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { console.log(message); });
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Pasaste un objeto con el atributo tabId. Debe ser una variable de tipo numérico.

Caso de uso correcto:

 // other code chrome.tabs.sendMessage( tab.tabId, {message: 'Hello'} ); // other code

Documento API:

 chrome.tabs.sendMessage( tabId: number, // Pay attention here message: any, options?: object, responseCallback?: function, )
about 4 years ago · Santiago Gelvez Report
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!