forked from marktext/marktext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
68 lines (59 loc) · 1.43 KB
/
index.js
File metadata and controls
68 lines (59 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import Vue from 'vue'
import Vuex from 'vuex'
import { ipcRenderer } from 'electron'
import listenForMain from './listenForMain'
import project from './project'
import editor from './editor'
import layout from './layout'
import preferences from './preferences'
import autoUpdates from './autoUpdates'
import notification from './notification'
import tweet from './tweet'
import commandCenter from './commandCenter'
Vue.use(Vuex)
// global states
const state = {
platform: process.platform, // platform of system `darwin` | `win32` | `linux`
appVersion: process.versions.MARKTEXT_VERSION_STRING, // MarkText version string
windowActive: true, // whether current window is active or focused
init: false // whether MarkText is initialized
}
const getters = {}
const mutations = {
SET_WIN_STATUS (state, status) {
state.windowActive = status
},
SET_INITIALIZED (state) {
state.init = true
}
}
const actions = {
LINTEN_WIN_STATUS ({ commit, state }) {
ipcRenderer.on('mt::window-active-status', (e, { status }) => {
commit('SET_WIN_STATUS', status)
})
},
SEND_INITIALIZED ({ commit }) {
commit('SET_INITIALIZED')
}
}
const store = new Vuex.Store({
state,
getters,
mutations,
actions,
modules: {
// have no states
listenForMain,
autoUpdates,
notification,
tweet,
// have states
project,
preferences,
editor,
layout,
commandCenter
}
})
export default store