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

226
Views
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
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!