forked from marktext/marktext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotification.js
More file actions
34 lines (26 loc) · 822 Bytes
/
Copy pathnotification.js
File metadata and controls
34 lines (26 loc) · 822 Bytes
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
import { ipcRenderer, shell } from 'electron'
import notice from '../services/notification'
const state = {}
const getters = {}
const mutations = {}
const actions = {
LISTEN_FOR_NOTIFICATION ({ commit }) {
const DEFAULT_OPTS = {
title: 'Infomation',
type: 'primary',
time: 10000,
message: 'You should never see this message'
}
ipcRenderer.on('mt::show-notification', (e, opts) => {
const options = Object.assign(DEFAULT_OPTS, opts)
notice.notify(options)
})
ipcRenderer.on('mt::pandoc-not-exists', async (e, opts) => {
const options = Object.assign(DEFAULT_OPTS, opts)
options.showConfirm = true
await notice.notify(options)
shell.openExternal('http://pandoc.org')
})
}
}
export default { state, getters, mutations, actions }