32 lines
775 B
JavaScript
32 lines
775 B
JavaScript
import { CustomHTMLElement } from "./lib/custom_html_element.mjs"
|
|
import { API } from './api.mjs'
|
|
|
|
export class N2PagePreferences extends CustomHTMLElement {
|
|
static {// {{{
|
|
this.tmpl = document.createElement('template')
|
|
this.tmpl.innerHTML = `
|
|
<h1>Preferences</h1>
|
|
`
|
|
}// }}}
|
|
constructor() {// {{{
|
|
super()
|
|
window._mbus.subscribe('SHOW_PAGE', event => {
|
|
if (event.detail.data?.page == 'preferences')
|
|
this.render()
|
|
})
|
|
}// }}}
|
|
async render() {// {{{
|
|
}// }}}
|
|
getPreferences() {
|
|
API.query('GET', '/user/preferences')
|
|
}
|
|
}
|
|
customElements.define('n2-pagepreferences', N2PagePreferences)
|
|
|
|
// Preferences is a set of preferences, of which there can be many named.
|
|
class Preferences {
|
|
constructor(name, data) {
|
|
this.name = name
|
|
this.data = data
|
|
}
|
|
}
|