allow for namespacing or nesting of events
See original GitHub issueIt is really nice that I can nest my actions in a mixin, like
actions: {
auth: {
login: () => {}
}
}
But if I have an event in the same mixin, I can’t do the same. Would it be worth making something like emit(‘auth.expired’) possible? I realize this is a minor convenience and would definitely not be in favour unless it is not too complicated to do.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Can namespaces be nested in C++? - GeeksforGeeks
In C++, namespaces can be nested, and resolution of namespace variables is hierarchical. For example, in the following code, namespace inner ...
Read more >How do you Declare Namespace in JavaScript? - Scaler Topics
Allows us to model different relationships using nested namespaces. Prevents memory leakage due to accidental global variables.
Read more >Essential JavaScript Namespacing Patterns - Addy Osmani
In JavaScript Patterns, Stoyan Stefanov presents a very-clever approach for automatically defining nested namespaces under an existing ...
Read more >Nesting JS namespaces - javascript - Stack Overflow
I am trying to using some sort of namespace ...
Read more >Namespaces (C++) - Microsoft Learn
The using directive allows all the names in a namespace to be used without the namespace-name as an explicit qualifier. Use a using...
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 Free
Top 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
As long as
emit
is called with a string, I disagree with the proposal. It’s needlessly complex and won’t help a lot since it only solves half of the problem.In case we decide to change that to a more action-like API (e.g.
app.events.example.event()
), I’d suggest mergingevents
, andactions
if possible or implement this feature request.Events act like reducers accross Mixins and App. So, I tried some things, but even if this is easy to split the event name to obtain a key river
"foo:bar:baz ==> appEvents[foo][bar][baz]
, I dont know if this feature would be easy to reason about.