Switch to using location-history package

https://npmjs.com/package/location-history
This commit is contained in:
Feross Aboukhadijeh
2016-07-28 20:07:12 -07:00
parent 43a81f725f
commit 536f04985f
6 changed files with 15 additions and 139 deletions

View File

@@ -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