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

153
Views
How do I use the PerformanceNavigationTiming API to track the duration of tasks across web workers and cross origin iframes?

Currently I am generating metrics on my web application by raising an event with a name and an associated absolute timestamp. These events are aggregated in a central repository of events that looks something like:

const metricEvents = [
  { name: appStart, time: window.performance.timing.responseStart }
]

metricEvents.push({ name: 'interactive', time: new Date().getTime() })

I can then subtract the end time from the start time and obtain a duration for that task.

My web application makes use of Web Workers and cross origin iframes, all of which contribute metric events of their own.

Currently it's pretty simple for me to send absolute timestamps from the workers/frames and still calculate the durations of events from points (e.g. A -> C or B -> E).

I see that PerformanceTiming is deprecated in favour of PerformanceNavigationTiming. The issue is that PerformanceNavigationTiming gives back relative times relavent to the current entity (frame, worker, host). This means I am no longer able to use my existing approach to calculate the task times.

Instinctively I look to obtain an absolute timestamps from the new PerformanceNavigationTiming API, is that possible or is there a better way to approach this objective with the new API?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Performance object has a timeOrigin property. You can use it to get absolute timings accross several contexts.

You can see this example from the specs which illustrate exactly your case.

about 4 years ago · Juan Pablo Isaza 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!