Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vuex-composition-helpers

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vuex-composition-helpers - npm Package Compare versions

Comparing version 1.0.23 to 1.0.24

3

dist/global.js

@@ -6,2 +6,5 @@ import { computed } from '@vue/composition-api';

}
export function useStore() {
return getStoreFromInstance();
}
export function useState(storeOrMap, map) {

@@ -8,0 +11,0 @@ let store = storeOrMap;

import { Store } from 'vuex/types';
import { ExtractGetterTypes, ExtractTypes, KnownKeys, RefTypes } from './util';
export declare function useStore<TState = any>(): Store<TState>;
export declare function useState<TState = any>(storeOrMap: Store<TState> | KnownKeys<TState>[], map?: KnownKeys<TState>[]): RefTypes<TState>;

@@ -4,0 +5,0 @@ export declare function useGetters<TGetters = any>(storeOrMap: Store<any> | KnownKeys<TGetters>[], map?: KnownKeys<TGetters>[]): ExtractGetterTypes<TGetters>;

2

package.json
{
"name": "vuex-composition-helpers",
"version": "1.0.23",
"version": "1.0.24",
"description": "Helpers to use Vuex store form Vue Composition API",

@@ -5,0 +5,0 @@ "author": "David Meir-Levy <davidmeirlevy@gmail.com>",

@@ -128,2 +128,32 @@ # vuex-composition-helpers

#### Typescript Namespaced Usage Example
```ts
import { useState, useActions } from 'vuex-composition-helpers';
import { ModuleState, ModuleGetters, ModuleActions, ModuleMutations } from "../store/subModule"
export default {
props: {
articleId: String
},
setup(props) {
const { useState, useActions } = createNamespacedHelpers<
ModuleState,
ModuleGetters,
ModuleActions,
ModuleMutations
>('articles'); // specific module name and generics
const { fetch } = useActions(['fetch']); // no generics needed any more
const { article, comments } = useGetters(['article', 'comments']); // no generics needed any more
fetch(props.articleId); // dispatch the "fetch" action
return {
// both are computed compositions for to the store
article,
comments
}
}
}
```
### Advanced Usage Example

@@ -130,0 +160,0 @@

@@ -9,2 +9,6 @@ import {Store} from 'vuex/types';

export function useStore<TState = any>() {
return getStoreFromInstance() as Store<TState>
}
export function useState<TState = any>(storeOrMap: Store<TState> | KnownKeys<TState>[], map?: KnownKeys<TState>[]): RefTypes<TState> {

@@ -11,0 +15,0 @@ let store = storeOrMap;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc