8000 GitHub - khphillips/vuex-gitstore: https://github.com/khphillips/darknote.git
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

khphillips/vuex-gitstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vuex-gitstore

Intended use with Electron or server side javascript as it needs access to the local file system. git-js dependency. Will save the entire store.state to individual json files for each key within the root. Options to pass a key to store only portions of the state.

import Vue from 'vue'
import Vuex from 'vuex'
import GitStore from 'vuex-gitstore'

Vue.use(Vuex)

const store = new Vuex.Store({
	plugins: [
		GitStore.install({})//pass options.
	]
})

export default store

key if you only want to target one key within the vuex store state, assign it here. For example with Vuex ORM use {key : 'entities'},

repo rename the default repo folder/name to something else. default is 'data' {repo : 'my_data_repo'}

root_path change where the json files are kept. default is 'gitstoreData/' {repo : 'my_data/somewhere_else/'}

Use with Vuex ORM

import Vue from 'vue'
import Vuex from 'vuex'
import VuexORM from '@vuex-orm/core'
import config from '../../config'
import Item from '../models/Item'

Vue.use(Vuex)

const database = new VuexORM.Database()

database.register(Item)

const store = new Vuex.Store({
	plugins: [
  		VuexORM.install(database),
  		config.storage.driver.install({
	  		key : 'entities', 
	  		repo : 'darknote',
	  		root_path : 'darknoteData/'
  		})
  	]
})

export default store

Releases

No releases published

Packages

No packages published
0