Small cleanup
This commit is contained in:
parent
74851b9c4d
commit
c8308664d3
2 changed files with 5 additions and 4 deletions
|
|
@ -66,7 +66,6 @@ export class App {
|
|||
|
||||
_mbus.subscribe('DEVICE_PREFERENCE_SET_UPDATED', ()=>{
|
||||
this.preferences = this.getPreferences()
|
||||
console.log(this.preferences.data)
|
||||
})
|
||||
|
||||
window.addEventListener('keydown', event => this.keyHandler(event))
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export class N2PagePreferences extends CustomHTMLElement {
|
|||
|
||||
this.elNewSet.addEventListener('click', () => this.newSet())
|
||||
this.elSave.addEventListener('click', () => this.save())
|
||||
this.elDevPreferenceSet.addEventListener('change', event=>this.changePreferenceSet(event))
|
||||
this.elDevPreferenceSet.addEventListener('change', ()=>this.changePreferenceSet())
|
||||
|
||||
window._mbus.subscribe('SHOW_PAGE', async event => {
|
||||
if (event.detail.data?.page == 'preferences') {
|
||||
|
|
@ -71,7 +71,7 @@ export class N2PagePreferences extends CustomHTMLElement {
|
|||
this.sets.sort(this.sortSets)
|
||||
this.elSets.replaceChildren(...this.sets)
|
||||
|
||||
const setNames = this.sets.entries().map(([i, set]) => {
|
||||
const setNames = this.sets.entries().map(([_idx, set]) => {
|
||||
const optn = document.createElement('option')
|
||||
optn.innerText = set.name
|
||||
return optn
|
||||
|
|
@ -106,7 +106,7 @@ export class N2PagePreferences extends CustomHTMLElement {
|
|||
alert(`Error retrieving preferences: ${e.message}`)
|
||||
}
|
||||
}// }}}
|
||||
changePreferenceSet(event) {// {{{
|
||||
changePreferenceSet() {// {{{
|
||||
this.preferencesModified()
|
||||
}// }}}
|
||||
newSet() {// {{{
|
||||
|
|
@ -168,6 +168,8 @@ export class N2PagePreferences extends CustomHTMLElement {
|
|||
user.Preferences = newPrefs
|
||||
localStorage.setItem('user', JSON.stringify(user))
|
||||
localStorage.setItem('device_preference_set', this.elDevPreferenceSet.value)
|
||||
|
||||
// Application is told that reloading preferences is to be done.
|
||||
_mbus.dispatch('DEVICE_PREFERENCE_SET_UPDATED')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue