import NoteContextAwareWidget from "./note_context_aware_widget.js"; const TPL = `
`; export default class SwitchWidget extends NoteContextAwareWidget { doRender() { this.$widget = $(TPL); this.$switchOn = this.$widget.find(".switch-on"); this.$switchOnName = this.$widget.find(".switch-on-name"); this.$switchOnButton = this.$widget.find(".switch-on-button"); this.$switchOnButton.on('click', () => this.toggle(true)); this.$switchOff = this.$widget.find(".switch-off"); this.$switchOffName = this.$widget.find(".switch-off-name"); this.$switchOffButton = this.$widget.find(".switch-off-button"); this.$switchOffButton.on('click', () => this.toggle(false)); this.$helpButton = this.$widget.find(".switch-help-button"); } toggle(state) { if (state) { this.switchOn(); } else { this.switchOff(); } } switchOff() {} switchOn() {} }