state: Use dispatch instead of direct call

This commit is contained in:
Feross Aboukhadijeh
2016-09-21 11:48:23 -07:00
parent 167da9dfd5
commit 1e05487acd
2 changed files with 2 additions and 4 deletions

View File

@@ -1,4 +1,3 @@
const State = require('../lib/state')
const {dispatch} = require('../lib/dispatcher') const {dispatch} = require('../lib/dispatcher')
const ipcRenderer = require('electron').ipcRenderer const ipcRenderer = require('electron').ipcRenderer
@@ -56,7 +55,7 @@ module.exports = class PrefsController {
ipcRenderer.send('setStartup', state.unsaved.prefs.startup) ipcRenderer.send('setStartup', state.unsaved.prefs.startup)
} }
state.saved.prefs = Object.assign(state.saved.prefs || {}, state.unsaved.prefs) state.saved.prefs = Object.assign(state.saved.prefs || {}, state.unsaved.prefs)
State.save(state) dispatch('saveState')
dispatch('checkDownloadPath') dispatch('checkDownloadPath')
} }
} }

View File

@@ -4,7 +4,6 @@ const electron = require('electron')
const {dispatch} = require('../lib/dispatcher') const {dispatch} = require('../lib/dispatcher')
const {TorrentKeyNotFoundError} = require('../lib/errors') const {TorrentKeyNotFoundError} = require('../lib/errors')
const State = require('../lib/state')
const sound = require('../lib/sound') const sound = require('../lib/sound')
const TorrentSummary = require('../lib/torrent-summary') const TorrentSummary = require('../lib/torrent-summary')
@@ -159,7 +158,7 @@ module.exports = class TorrentListController {
// remove torrent from saved list // remove torrent from saved list
this.state.saved.torrents.splice(index, 1) this.state.saved.torrents.splice(index, 1)
State.saveThrottled(this.state) dispatch('saveStateThrottled')
} }
// prevent user from going forward to a deleted torrent // prevent user from going forward to a deleted torrent