Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda