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

158
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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