Re: [w3ctag/design-reviews] scheduler.postTask() API (#338)

> What happens in this case?
> 
> ```js
> const controller = new TaskController('user-blocking');
> scheduler.postTask(doWork, { signal, priority: 'background' });
> ```

`signal` gets downcast to an `AbortSignal`, allowing the abort component of the signal to be propagated while supporting the ability to spawn different priority subtasks.

A use case we had in mind is if devs want to post independent low priority subtasks that should still be canceled with the parent task. One example of this might be logging or cleanup tasks.

**Note**:  I'm working on a separate explainer/issue to explore implementing TaskSignal this way (as an extension of AbortSignal) vs. having/supporting separable signals (e.g. PrioritySignal), and potentially making TaskSignal a composite. Where I think things get complicated is if/when more signals get added to the platform and how they interact with the various APIs. I'm planning to loop TAG folks and others in on that as well once it's written.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/338#issuecomment-594314342

Received on Wednesday, 4 March 2020 04:02:20 UTC