1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-01-27 07:46:15 +01:00

refs #24 Remove ipcRenderer listeners for keyboard shortcuts

This commit is contained in:
AkiraFukushima 2018-03-14 14:57:51 +09:00
parent 4f47a79bf7
commit 2eb0454a24
2 changed files with 7 additions and 2 deletions

View File

@ -22,9 +22,9 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.$store.dispatch('TimelineSpace/watchShortcutEvents')
this.$store.dispatch('TimelineSpace/fetchAccount', this.$route.params.id)
.then((account) => {
this.$store.dispatch('TimelineSpace/watchShortcutEvents', account)
this.$store.dispatch('TimelineSpace/fetchHomeTimeline', account)
.then(() => {
loading.close()
@ -68,6 +68,7 @@ export default {
},
beforeDestroy () {
this.$store.dispatch('TimelineSpace/stopUserStreaming')
this.$store.dispatch('TimelineSpace/removeShortcutEvents')
}
}
</script>

View File

@ -99,7 +99,7 @@ const TimelineSpace = {
ipcRenderer.removeAll('error-start-user-streaming')
ipcRenderer.send('stop-user-streaming')
},
watchShortcutEvents ({ commit }, account) {
watchShortcutEvents ({ commit }) {
ipcRenderer.on('CmdOrCtrl+N', () => {
commit('changeNewTootModal', true)
})
@ -108,6 +108,10 @@ const TimelineSpace = {
console.log('reply')
})
},
removeShortcutEvents () {
ipcRenderer.removeAll('CmdOrCtrl+N')
ipcRenderer.removeAll('CmdOrCtrl+R')
},
fetchHomeTimeline ({ commit }, account) {
return new Promise((resolve, reject) => {
const client = new Mastodon(