Switch to using location-history package
https://npmjs.com/package/location-history
This commit is contained in:
@@ -28,11 +28,11 @@ module.exports = class PlaybackController {
|
||||
playFile (infoHash, index /* optional */) {
|
||||
this.state.location.go({
|
||||
url: 'player',
|
||||
onbeforeload: (cb) => {
|
||||
setup: (cb) => {
|
||||
this.play()
|
||||
this.openPlayer(infoHash, index, cb)
|
||||
},
|
||||
onbeforeunload: (cb) => this.closePlayer(cb)
|
||||
destroy: () => this.closePlayer()
|
||||
}, (err) => {
|
||||
if (err) dispatch('error', err)
|
||||
})
|
||||
@@ -251,7 +251,7 @@ module.exports = class PlaybackController {
|
||||
})
|
||||
}
|
||||
|
||||
closePlayer (cb) {
|
||||
closePlayer () {
|
||||
console.log('closePlayer')
|
||||
|
||||
// Quit any external players, like Chromecast/Airplay/etc or VLC
|
||||
@@ -290,7 +290,6 @@ module.exports = class PlaybackController {
|
||||
ipcRenderer.send('onPlayerClose')
|
||||
|
||||
this.update()
|
||||
cb()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,24 +13,19 @@ module.exports = class PrefsController {
|
||||
var state = this.state
|
||||
state.location.go({
|
||||
url: 'preferences',
|
||||
onbeforeload: function (cb) {
|
||||
setup: function (cb) {
|
||||
// initialize preferences
|
||||
dispatch('setTitle', 'Preferences')
|
||||
state.unsaved = Object.assign(state.unsaved || {}, {prefs: state.saved.prefs || {}})
|
||||
cb()
|
||||
},
|
||||
onbeforeunload: (cb) => {
|
||||
// save state after preferences
|
||||
this.save()
|
||||
dispatch('resetTitle')
|
||||
cb()
|
||||
}
|
||||
destroy: () => this.save()
|
||||
})
|
||||
}
|
||||
|
||||
// Updates a single property in the UNSAVED prefs
|
||||
// For example: updatePreferences('foo.bar', 'baz')
|
||||
// Call savePreferences to save to config.json
|
||||
// Call save() to save to config.json
|
||||
update (property, value) {
|
||||
var path = property.split('.')
|
||||
var key = this.state.unsaved.prefs
|
||||
|
||||
Reference in New Issue
Block a user