greenpress / vuex-composition-helpers

A util package to use Vuex with Composition API easily.
https://www.npmjs.com/package/vuex-composition-helpers
MIT License
288 stars 32 forks source link

[Feature Request] In-place namespaces #57

Closed nolde closed 2 years ago

nolde commented 2 years ago

Would be nice to have "in-place" namespaces, similar to what happens with vuex mappers.

import { useGetters } from 'vuex-composition-helpers'

export default {
  setup() {
    const { one, two } = useGetters('my/long/name/space', ['one', 'two'])
    const { uno, dos } = useGetters('my/other/thing', ['uno', 'dos'])
    return { one, two, uno, dos }
  }
}
davidmeirlevy commented 2 years ago

@nolde as you can see in the source code, the global functions are passing null as a namespace to the useMapping function.

If you like to create an improvement that will pass the namespace to the global functions, you're welcome, just make sure all the tests will pass :)