[{"data":1,"prerenderedAt":169},["ShallowReactive",2],{"term-s\u002Fscheduler-api":3,"related-s\u002Fscheduler-api":155},{"id":4,"title":5,"acronym":6,"body":7,"category":136,"description":137,"difficulty":138,"extension":139,"letter":140,"meta":141,"navigation":142,"path":143,"related":144,"seo":149,"sitemap":150,"stem":153,"subcategory":6,"__hash__":154},"terms\u002Fterms\u002Fs\u002Fscheduler-api.md","Scheduler API",null,{"type":8,"value":9,"toc":130},"minimark",[10,15,19,23,26,30,119,123,126],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 - The Vibe Check",[16,17,18],"p",{},"The Scheduler API is a built in way to tell the browser this task matters a lot, do it soon, or this one can wait until you're not busy. Before this, developers faked task priority with setTimeout hacks and requestIdleCallback workarounds. Now there's an actual priority queue baked into the platform, and React's own scheduler is built on the same idea.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"The Scheduler API, primarily scheduler.postTask(), is a browser API for scheduling tasks with explicit priorities such as user-blocking, user-visible, or background, letting the browser interleave work without freezing the main thread. It supersedes ad hoc patterns built on setTimeout(fn, 0) and requestIdleCallback for breaking up long JavaScript tasks.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","await scheduler.postTask(() => {\n  renderNonCriticalWidget();\n}, { priority: 'background' });\n","javascript","",[38,39,40,74,86],"code",{"__ignoreMap":36},[41,42,45,49,53,57,61,64,67,71],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"s7zQu","await",[41,50,52],{"class":51},"sTEyZ"," scheduler",[41,54,56],{"class":55},"sMK4o",".",[41,58,60],{"class":59},"s2Zo4","postTask",[41,62,63],{"class":51},"(",[41,65,66],{"class":55},"()",[41,68,70],{"class":69},"spNyl"," =>",[41,72,73],{"class":55}," {\n",[41,75,77,80,83],{"class":43,"line":76},2,[41,78,79],{"class":59},"  renderNonCriticalWidget",[41,81,66],{"class":82},"swJcz",[41,84,85],{"class":55},";\n",[41,87,89,92,95,98,101,104,108,111,114,117],{"class":43,"line":88},3,[41,90,91],{"class":55},"},",[41,93,94],{"class":55}," {",[41,96,97],{"class":82}," priority",[41,99,100],{"class":55},":",[41,102,103],{"class":55}," '",[41,105,107],{"class":106},"sfazB","background",[41,109,110],{"class":55},"'",[41,112,113],{"class":55}," }",[41,115,116],{"class":51},")",[41,118,85],{"class":55},[11,120,122],{"id":121},"when-youll-hear-this","When You'll Hear This",[16,124,125],{},"\"We moved our analytics batching to scheduler.postTask with background priority so it never competes with clicks.\" \u002F \"The Scheduler API let us drop our homemade requestIdleCallback polyfill.\"",[127,128,129],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":76,"depth":76,"links":131},[132,133,134,135],{"id":13,"depth":76,"text":14},{"id":21,"depth":76,"text":22},{"id":28,"depth":76,"text":29},{"id":121,"depth":76,"text":122},"frontend","The Scheduler API is a built in way to tell the browser this task matters a lot, do it soon, or this one can wait until you're not busy.","advanced","md","s",{},true,"\u002Fterms\u002Fs\u002Fscheduler-api",[145,146,147,148],"Event Loop","INP","Long Tasks","requestAnimationFrame",{"title":5,"description":137},{"changefreq":151,"priority":152},"weekly",0.7,"terms\u002Fs\u002Fscheduler-api","jYDh2mVP8sc9ypRTTKPYoApfvrNmpo-OGKVS5o1mKDY",[156,159,163,166],{"title":145,"path":157,"acronym":6,"category":136,"difficulty":138,"description":158},"\u002Fterms\u002Fe\u002Fevent-loop","JavaScript can only do one thing at a time (single-threaded), but the Event Loop is the trick that makes it seem like it can multitask.",{"title":146,"path":160,"acronym":146,"category":136,"difficulty":161,"description":162},"\u002Fterms\u002Fi\u002Finp","intermediate","INP measures how snappy your website feels every time you interact with it — not just the first click, but every button press, dropdown open, and form subm...",{"title":147,"path":164,"acronym":6,"category":136,"difficulty":161,"description":165},"\u002Fterms\u002Fl\u002Flong-tasks","Long Tasks are any JavaScript tasks that take more than 50ms and block the main thread.",{"title":148,"path":167,"acronym":6,"category":136,"difficulty":161,"description":168},"\u002Fterms\u002Fr\u002Frequestanimationframe","requestAnimationFrame tells the browser 'call my function right before the next screen repaint.",1792528121639]