2021-05-19 22:06:59 +01:00
|
|
|
//
|
|
|
|
const store = new Vuex.Store({
|
2021-05-20 15:29:24 +01:00
|
|
|
state: {
|
|
|
|
count: 92,
|
|
|
|
|
|
|
|
edit: {
|
|
|
|
currentId: "?",
|
|
|
|
query: "todo edit/query"
|
|
|
|
},
|
|
|
|
"features": {
|
|
|
|
"serviceworker": false
|
|
|
|
},
|
|
|
|
"images": {
|
|
|
|
thumbtask: `<thumbnail>
|
2021-05-19 22:06:59 +01:00
|
|
|
<size width="200" height="200"/>
|
|
|
|
<filters>
|
|
|
|
<colorize color="green" alpha=".5"/>
|
|
|
|
<caption position="CENTER">Some Text here</caption>
|
|
|
|
<rotate angle="15"/>
|
|
|
|
<canvas height="300" width="300" position="TOP_LEFT" color="yellow"/>
|
|
|
|
</filters>
|
|
|
|
<output format="gif"/>
|
|
|
|
</thumbnail>
|
|
|
|
`
|
2021-05-20 15:29:24 +01:00
|
|
|
},
|
|
|
|
"settings": {
|
|
|
|
"ace": {
|
|
|
|
theme: "github",
|
|
|
|
themeDark: "chaos",
|
|
|
|
keybinding: "ace",
|
|
|
|
fontsize: 16,
|
|
|
|
enableSnippets: true,
|
|
|
|
enableBasicAutocompletion: true,
|
|
|
|
enableLiveAutocompletion: true
|
|
|
|
},
|
|
|
|
"dark": false
|
|
|
|
},
|
|
|
|
"markdown": {
|
|
|
|
"toc": true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mutations: {
|
|
|
|
increment(state) {
|
|
|
|
state.count++
|
|
|
|
},
|
|
|
|
initialiseStore(state) {
|
|
|
|
// Check if the ID exists
|
|
|
|
var s = localStorage.getItem('store')
|
|
|
|
if (s) {
|
|
|
|
// Replace the state object with the stored item
|
|
|
|
this.replaceState(
|
|
|
|
Object.assign(state, JSON.parse(s))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
//console.log("initialiseStore: ",s)
|
2021-05-19 22:06:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
store.subscribe((mutation, state) => {
|
|
|
|
// Store the state object as a JSON string
|
|
|
|
localStorage.setItem('store', JSON.stringify(state));
|
|
|
|
//console.log("store subscribe")
|
|
|
|
});
|