Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Making this pr so that we can evaluate if we like this abstraction to create handlers...i've implemented the default one and enqueue.
I'm open to name critiques and also general discussion on the approach. Basically we just have an object with all the handlers and every handler is a factory handler (so that it can have internal state like the queue or stuff like that).
For the moment i've passed the promise and the abort controller to the actual runner so that inside it it can await the promise to make sure the task instance finished running or stop it (we will need it for the restartable)
EDIT: i've also added the automatic creation of a series of shorthands. Basically whenever you add a new handler you will be able to create that handler like this
AND like this
all of this with typesafety...so if the handler accept some prop (like
{max:number}
forenqueue
) you will get intellisense for both caseseg:
AND like this
personally i think it's a nice api and abstraction but eager to see what you think about it.