Skip to Content
Ingeniería del rendimiento web en la era de la IA (Spanish Edition)
book

Ingeniería del rendimiento web en la era de la IA (Spanish Edition)

by Addy Osmani
February 2026
Intermediate to advanced
256 pages
8h 40m
Spanish
O'Reilly Media, Inc.
Content preview from Ingeniería del rendimiento web en la era de la IA (Spanish Edition)

Capítulo 10. Programación y optimización de scripts de terceros (y el papel de la IA)

Este trabajo se ha traducido utilizando IA. Agradecemos tus opiniones y comentarios: translation-feedback@oreilly.com

Incluso después de decidir qué scripts de terceros cargar y cuándo, hay un nivel adicional de optimización en cuanto a cuándo ejecutar determinadas tareas. Los navegadores tienen la capacidad de programar tareas durante los periodos de inactividad o después de que se haya completado la carga principal, lo que puede ayudar a gestionar las tareas de terceros que no son urgentes. Este enfoque garantiza que el código de terceros no crítico se ejecute cuando no interfiera con la capacidad de respuesta o la representación.

Programación de scripts de terceros

La herramienta principal para programar tareas no urgentes en el navegador es window.requestIdleCallback.

La API requestIdleCallback

Esta API te permite registrar una función que debe ejecutarse cuando el bucle de eventos del navegador está inactivo (cuando no tiene más tareas urgentes que realizar, como el diseño, el dibujo o el manejo de las entradas del usuario). El navegador intentará ejecutar tu callback en los intervalos de inactividad. También puedes proporcionar un tiempo de espera para garantizar que se ejecute finalmente, incluso si el tiempo de inactividad es escaso.

A continuación se muestra cómo utilizar window.requestIdleCallback:

if ('requestIdleCallback' in window) {

  requestIdleCallback(() => {

    // Execute non-critical ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Ingeniería del rendimiento de sistemas de IA. (Spanish Edition)

Ingeniería del rendimiento de sistemas de IA. (Spanish Edition)

Chris Fregly

Publisher Resources

ISBN: 0642572331696