Just to make it bit more Vue/Nuxt 3 way, I think it would have been useful to wrap the logic from last chapters of the article into a composable like useEmitEvent and useListenEvent (names can be choosen better :D )
You could pass the name of the event as the first parameter and value as the second one. Thanks to that you could make the composable auto imported so that user would not have to import nuxtApp everytime :)
Not sure about Pinta making it that simple but for sure there are multiple ways to get similar behaviour. Even @atinux suggested using unjs/hookable twitter.com/Atinux/status/15946800...
Thank you @israelortuno this is a great explanation. I've been searching for this answer for a couple days now and this simple, yet carefully explained example, is just money. Much appreciated.
We're a place where coders share, stay up-to-date and grow their careers.
Really good article!
Just to make it bit more Vue/Nuxt 3 way, I think it would have been useful to wrap the logic from last chapters of the article into a composable like
useEmitEventanduseListenEvent(names can be choosen better :D )But overall really nice one!
You could pass the name of the event as the first parameter and value as the second one. Thanks to that you could make the composable auto imported so that user would not have to import nuxtApp everytime :)
Jakub is on fire on Dev. 🔥🔥🔥
Added a composable example, thanks for the feedback
Isn't this solved in a nicer way by state management plugins like pinia?
Not sure about Pinta making it that simple but for sure there are multiple ways to get similar behaviour. Even @atinux suggested using unjs/hookable twitter.com/Atinux/status/15946800...
thanks, will check that also
Build a nuxt module around
mitt-Nuxt-MitterI would be grateful for any feedback or suggestions for improvement
npm-nuxt-mitter
Here is my composable solution with hooks.
gist.github.com/eserdinyo/5acf5924...
ref: twitter.com/Atinux/status/15946800...
Hi, this is great, how to write the type of emit and on please, thanks!
What's the difference with unjs/hookable used by nuxt?
Thank you @israelortuno this is a great explanation. I've been searching for this answer for a couple days now and this simple, yet carefully explained example, is just money. Much appreciated.