This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 1220" role="img" aria-labelledby="title desc">
|
||||
<title id="title">Очередность синхронного кода, microtask и timer-задачи</title>
|
||||
<desc id="desc">Вертикальная схема показывает: синхронный код завершает текущий стек, затем выполняется microtask Promise, после чего event loop может выбрать timer-задачу.</desc>
|
||||
<rect width="720" height="1220" rx="32" fill="#0f172a"/>
|
||||
<text x="56" y="82" fill="#f8fafc" font-family="Arial, sans-serif" font-size="40" font-weight="700">Порядок одного тика</text>
|
||||
<text x="56" y="124" fill="#f8fafc" font-family="Arial, sans-serif" font-size="40" font-weight="700">не угадываем, записываем</text>
|
||||
<text x="56" y="172" fill="#94a3b8" font-family="Arial, sans-serif" font-size="25">Сначала стек, затем microtask checkpoint,</text>
|
||||
<text x="56" y="206" fill="#94a3b8" font-family="Arial, sans-serif" font-size="25">после этого — следующая доступная task.</text>
|
||||
<g font-family="Arial, sans-serif">
|
||||
<rect x="56" y="268" width="608" height="174" rx="22" fill="#2563eb"/>
|
||||
<circle cx="116" cy="326" r="34" fill="#dbeafe"/>
|
||||
<text x="116" y="335" fill="#1e3a8a" font-size="25" font-weight="700" text-anchor="middle">1</text>
|
||||
<text x="174" y="330" fill="#fff" font-size="31" font-weight="700">Текущий стек</text>
|
||||
<text x="174" y="370" fill="#dbeafe" font-size="25">sync: A, затем D</text>
|
||||
<text x="174" y="406" fill="#dbeafe" font-size="22">Выполнить функцию до return.</text>
|
||||
<path d="M360 462v58l-23-25h46z" fill="#64748b"/>
|
||||
<rect x="56" y="548" width="608" height="174" rx="22" fill="#7c3aed"/>
|
||||
<circle cx="116" cy="606" r="34" fill="#ede9fe"/>
|
||||
<text x="116" y="615" fill="#4c1d95" font-size="25" font-weight="700" text-anchor="middle">2</text>
|
||||
<text x="174" y="610" fill="#fff" font-size="31" font-weight="700">Microtask checkpoint</text>
|
||||
<text x="174" y="650" fill="#ede9fe" font-size="25">Promise: B</text>
|
||||
<text x="174" y="686" fill="#ede9fe" font-size="22">Очистить накопленную очередь.</text>
|
||||
<path d="M360 742v58l-23-25h46z" fill="#64748b"/>
|
||||
<rect x="56" y="828" width="608" height="174" rx="22" fill="#0891b2"/>
|
||||
<circle cx="116" cy="886" r="34" fill="#cffafe"/>
|
||||
<text x="116" y="895" fill="#155e75" font-size="25" font-weight="700" text-anchor="middle">3</text>
|
||||
<text x="174" y="890" fill="#fff" font-size="31" font-weight="700">Будущая task</text>
|
||||
<text x="174" y="930" fill="#cffafe" font-size="25">timer: C</text>
|
||||
<text x="174" y="966" fill="#cffafe" font-size="22">Event loop выбирает доступную работу.</text>
|
||||
</g>
|
||||
<rect x="56" y="1064" width="608" height="104" rx="16" fill="#1e293b"/>
|
||||
<text x="88" y="1112" fill="#e2e8f0" font-family="Arial, sans-serif" font-size="25">Порядок опыта: A → D → B → C.</text>
|
||||
<text x="88" y="1148" fill="#cbd5e1" font-family="Arial, sans-serif" font-size="21">Timer не обязан запускаться сразу после 0 ms.</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
Reference in New Issue
Block a user