Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
When I was developing a Google plug-in, an error occurred during front-end and back-end interaction

I have a question when i dev chrome extensions use React this is the log handler in background.js and BackgroundConsole is no error the loggerList is async

interface ILog {
  date: string;
  level: 'debug' | 'info' | 'warn' | 'error';
  msg: string;
}  
static loggerList: string= []
static async loggerLists(log: ILog[]) {
    this.setLogList().then(async (res) => {
      await res
      console.log(res);
      chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
        if (request.type === 'log') {
          sendResponse({
            log: res
          })
        }
        return true
      })
    })
  };
  static async setLogList() {
    return new Promise((resolve, reject) => {
      resolve(this.loggerList)
    })
  }

this is the popup.js when i use callback receive args

  const [logList, setlogList] = useState([])
  chrome.runtime.sendMessage({
    type: 'log'
  }, res => {
    setlogList(res.log)
    console.log(res, res.log, '1111111111111');
    //PopupConsole is endless loop to console.log(res, res.log, '1111111111111')
  })

this is the new code with pupup.js

  const [logList, setlogList] = useState([])
  useEffect(() => chrome.runtime.sendMessage({ type: "log" }, res => {
    console.log(res);
    setlogList(res.log)
  }), [])
      <Modal title="Basic Modal" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}>
        {
          logList.map((val: any) => {
            { JSON.stringify(val) }
            // return (
            <>
              <p>{val.date}</p>
              <p>{val.level}</p>
              <p>{val.msg}</p>
              <p>{val}</p>
            </>
            // )
          })
        }
      </Modal>

this is show page

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda