alexlafroscia / use-task

A React hook for running and cancelling asynchronous tasks
https://use-task.now.sh
24 stars 1 forks source link

Integrate with `scheduler` #5

Open alexlafroscia opened 5 years ago

alexlafroscia commented 5 years ago

As suggested by @poteto, it seems like useTask might be a good opportunity to integrate with the scheduler package. An initial thought it that some point within perform could schedule the asynchronous work into a lower-priority queue, so that a task being performed based on user input has a good chance of being cancelled. This would be useful, for example, in a system that makes a network request as users type.

Resources

alexlafroscia commented 5 years ago

Reading into the API more, there are APIs for cancelling scheduled tasks, too. It’s definitely worth investigating how cancelling a task could cancel any scheduled work.