MartinMalinda / vue-concurrency

A library for encapsulating asynchronous operations and managing concurrency for Vue and Composition API.
https://vue-concurrency.netlify.app/
MIT License
352 stars 15 forks source link

Added global event handler framework for issue 76 #81

Closed TRScheel closed 2 years ago

TRScheel commented 2 years ago

Issue #76 requested a global event handler for errors.

In this pull request I have set up the framework for a global event handler store and testing for such a store. I didn't want to go too much further than this before presenting it for review/comments.

I deliberately made it extensible to add for other global event hooks but currently it is only set up for OnError

It works by making a light global store of event handlers and only exposes that store through a set of controlled functions.

Note: I wrote this while on the road. Couldn't give it the sort of thorough check that I'd normally prefer.

MartinMalinda commented 2 years ago

Thanks a lot for this! I like where it's going. It needs some discussion what's the best end result here but I don't expect any blockers here.

TRScheel commented 2 years ago

No problems, I am going to keep working on it while I am traveling. I figured it'd be best to get what I had so far up for review and comments before getting too far since my internet is spotty at the moment and my focus is distracted. Wouldn't want to go deep down the wrong path before realizing I had made a critical mistake.

TRScheel commented 2 years ago

@MartinMalinda I've updated everything per your comments.

MartinMalinda commented 2 years ago

This got closed because the vue3 branch was deleted. I can't reopen automatically. I will take a look on this next week hopefully, starting a new PR with your commits 🙏