Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for unregisterModule #53

Open
Joebayld opened this issue Feb 24, 2021 · 1 comment
Open

Add support for unregisterModule #53

Joebayld opened this issue Feb 24, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@Joebayld
Copy link

I'm looking to use this to dynamically add / remove Vuex stores. Has anyone come across this?

Vuex has a unregisterModule function for this purpose - just wondering the best way to use it with this library.

https://vuex.vuejs.org/guide/modules.html#dynamic-module-registration

Thanks!

@bodograumann bodograumann added the enhancement New feature or request label Feb 24, 2021
@gertqin
Copy link
Owner

gertqin commented Mar 7, 2021

Well, you can just unregister the module using the store, e.g.

// register.ts
import store from "./store"

@Module
class MyModule extends VuexModule {
  // ...
}

const myModule = new MyModule({ name: "myModule", store })

// unregister.ts
import store from "./store"
store.unregisterModule("myModule")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants