Web Performance Optimization & Lighthouse · درس

التفاعل حتى العرض التالي (INP)

افهم INP، وهو أحد مؤشرات الويب الحيوية الأساسية التي تقيس سرعة الاستجابة في العالم الحقيقي، وكيف يُحتسب طوال الزيارة، والتقنيات اللازمة للحفاظ على سرعة التفاعلات.

الدرس 4 من 413 خطوة

التفاعل حتى العرض التالي (INP) درس مجاني في Web Performance Optimization & Lighthouse على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Web Performance Optimization & Lighthouse، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Web Performance Optimization & Lighthouse 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Responsiveness as a Vital

Interaction to Next Paint (INP) measures how quickly the page visually responds to user input across the whole visit. It became a Core Web Vital, replacing First Input Delay.

INP vs FID

FID only measured the first interaction's input delay. INP is broader: it considers all interactions and the full latency through event handling and rendering, not just the initial delay.

What an Interaction Includes

Each interaction's latency spans three parts: input delay (waiting for the main thread), processing time (event handlers), and presentation delay (rendering the next frame).

How INP Is Reported

Across a visit, INP reports roughly the worst interaction latency (with an allowance for outliers on pages with many interactions), so it reflects the user's worst-case responsiveness.

The Thresholds

  • Good: 200ms or less
  • Needs improvement: 200-500ms
  • Poor: over 500ms

The Main Thread Is the Bottleneck

Long tasks block the main thread so input cannot be handled promptly. Breaking up long JavaScript tasks is the single biggest lever for improving INP.

Yielding to the Main Thread

Break long work into chunks and yield so the browser can handle input between them. scheduler.yield() or a setTimeout based yield helps.

async function process(items) {
  for (const item of items) {
    handle(item);
    await new Promise(r => setTimeout(r, 0));
  }
}

Defer Non-Urgent Work

Update the UI immediately for feedback, then run heavy work afterward. Patterns like requestAnimationFrame for visual updates and deferring analytics keep handlers short.

button.addEventListener('click', () => {
  showSpinner();
  setTimeout(doHeavyWork, 0);
});

Reduce Rendering Cost

The presentation phase suffers from large DOM updates and expensive layout. Use content-visibility, virtualization, and minimal DOM changes to render the next frame faster.

Measuring INP

Capture INP in the field with the web-vitals library, and use the DevTools Performance panel's interaction track to see input delay, processing, and presentation for each event.

import { onINP } from 'web-vitals';
onINP(metric => console.log('INP', metric.value));

Improvement Checklist

  • Break up long tasks and yield.
  • Defer non-urgent work after paint.
  • Trim event handler work.
  • Reduce DOM size and rendering cost.

Quick Check

How does INP differ fundamentally from the metric it replaced, FID?

Recap

You learned INP measures whole-visit responsiveness across input delay, processing, and presentation, with a good threshold of 200ms. Improve it by breaking up long tasks, yielding to the main thread, deferring non-urgent work, and reducing rendering cost.

البدء مجانًا

تعلم Web Performance Optimization & Lighthouse مع معلم ذكاء اصطناعي — مجانًا

اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.

الدورات
12
الدروس
48

الأسئلة الشائعة

هل درس «التفاعل حتى العرض التالي (INP)» مجاني؟

نعم — نص درس «التفاعل حتى العرض التالي (INP)» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Web Performance Optimization & Lighthouse، انتقل إلى CoddyKit PRO. تتضمن دورة Web Performance Optimization & Lighthouse 4 دروس في المجموع.

ماذا ستتعلم في «التفاعل حتى العرض التالي (INP)»؟

افهم INP، وهو أحد مؤشرات الويب الحيوية الأساسية التي تقيس سرعة الاستجابة في العالم الحقيقي، وكيف يُحتسب طوال الزيارة، والتقنيات اللازمة للحفاظ على سرعة التفاعلات. تتمرن على Web Performance Optimization & Lighthouse مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Web Performance Optimization & Lighthouse؟

لا تُشترط خبرة سابقة. Web Performance Optimization & Lighthouse على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «التفاعل حتى العرض التالي (INP)»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Web Performance Optimization & Lighthouse هذا؟

نعم. كل درس في Web Performance Optimization & Lighthouse يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. مقدمة إلى Core Web Vitals
  2. تحليل معمّق لـ LCP وFID وCLS
  3. تحسين مقاييس تفاعل المستخدم
  4. التفاعل حتى العرض التالي (INP)
← العودة إلى Web Performance Optimization & Lighthouse