You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
behold, scheduler.yield is out and it can inherit abort signal from scheduler.postTask
example
letcontroller;asyncfunctionlongTask(){try{blockMainThread(500);// Yield the task using the scheduler, passing the signal from the controller// The "inherit" option means the task will inherit the signal from its parentawaitscheduler.yield({signal: "inherit"});// If the user cancels the task, the code below will not runblockMainThread(500);}catch(error){if(error.name==="AbortError"){// Handle the abort}}}startButton.addEventListener("click",()=>{controller=newTaskController();// Post the longTask to the scheduler, passing the signal from the controllerscheduler.postTask(longTask,{signal: controller.signal,});});cancelButton.addEventListener("click",()=>{if(controller){controller.abort();}});
refactor/delete
core/task.js
and usescheduler.postTask
The text was updated successfully, but these errors were encountered: