How do I access one module from another?
See original GitHub issueUsing NuxtJS (with TypeScript) I seem to have to specifically provide the store
when I use getModule
even though I have not defined my modules as dynamic. I cannot provide the store on the @module
statement because I cannot import a store it seems - it isn’t created at the point of the import.
This being so, I have to use getModule(MyModule, this.$store)
in my pages/components.
So how do I now access (for example) a getter from ModuleB
from an action in ModuleA
?
I am expecting to do something like this: ModuleA
import ModuleB from './moduleb`;
import { getModule } from 'vuex-module-decorators';
@Action
public async myAction(payload: IPayload): Promise<void> {
const moduleB = getModule(ModuleB, <I need the store here>);
const someModuleBData = moduleB.someModuleBGetter;
}
Where do I get the store from?
Issue Analytics
- State:
- Created 5 years ago
- Comments:26 (6 by maintainers)
Top Results From Across the Web
Can I access One module site-property from another module
You're best bet is to create a module containing public entity that is referenced by both of your module. Hello, The standard way...
Read more >How to access a variable from another module? - Stack Overflow
I have a module 'a' in package stack, i imported using the from and import keyword and used this way. from stack import...
Read more >Call your code from another module
Call your code from another module · Declare a main package. In Go, code executed as an application must be in a main...
Read more >How to call one module method into another
For complete access to one module's classes and methods from another, you would make the first module a declared dependency of the second...
Read more >Sharing modules - Angular
It re-exports the CommonModule and FormsModule. By re-exporting CommonModule and FormsModule , any other module that imports this SharedModule , gets access to ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
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
Why was this closed? Is there a solution that is typesafe now?
@pranavjindal999 Sounds like a good idea. I will check the feasibility of that.