useEventBus payload
See original GitHub issueconst modalBus = useEventBus<'show' | 'hide'>('modal')
modaBus.emit('show', {name: 'login-modal')
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
useEventBus - VueUse
Type Declarations # ; export declare type EventBusListener<T = unknown, P = any> = ( ; event: T ·, ; payload?: P ;...
Read more >fabienjuif/use-bus: React hook to subscribe and dispatch ...
dispatch({ type: 'string', payload: 3 }) : will dispatch the given action. useBus. import useBus from 'use-bus' : useBus(filter, callback, deps) ...
Read more >Using event bus in Vue.js to pass data between components
This post is a guide for passing data from one component to another using a special Vue instance. September 18, 2019 4 min...
Read more >Using the event bus - Quarkus
1, Inject the Event bus. 2, Send a message to the address greeting . Message payload is name. The EventBus object provides methods...
Read more >How to Use Event Bus in React Architecture | by Daw-Chih Liou
'on-event-1': (payload: { data: string }) => void }const myBus = eventbus<MyBus>(). You should be able to see a clear type definition when ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
mitt package api is really good. Being able to define payload type for each event type is easy
We usually use the Mitt with Provide/Inject API . (mitt function only triggered once time)
You can use
mitt
directly like this :But we usually use composable API in in anywhere and call it multi times , I guess that’s what
useEventBus
was designed for.https://github.com/vueuse/vueuse/blob/aef8a2b2459b064ea4d92c843db2f88ef3c0eb2c/packages/core/useEventBus/internal.ts#L4