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

227
Vistas
Looping not work on chrome.process.onUpdated.addListener Chrome Extension API

i have a chrome extension code that will give info about cpu usage of all chrome process (Fired each time the Task Manager updates its process statistics, providing the dictionary of updated Process objects, indexed by process ID.) when im on an active tab

the code

chrome.tabs.onActivated.addListener((tabs) => {
    let tabId = tabs.tabId;

    chrome.tabs.get(tabId, (tab) => {
        console.log(tab.url);
    });

    chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
        if(changeInfo.status == "complete"){
            console.log(tab.url);
        }
    });

    chrome.processes.onUpdated.addListener((x) => {
       console.log(x)
    });
});

it will result this enter image description here

enter image description here

the problem is i want to get only specific process where its cpu usage is above 500 and get the osProcessId for further action. i tried to do validation by using for loop but it return nothing. in other word, maybe my question is how to do validation on function that always do update everytime

specific process that have cpu load above 500 enter image description here

validation i tried to add to chrome.processes.onUpdated.addListener

chrome.processes.onUpdated.addListener((x) => {
        for(var i=0;i<x;i++){
            if(x[i].cpu >= 500){
                console.log(x[i].osProcessId)
            }
        }
    });
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