import AbstractSearchOption from "./abstract_search_option.js"; const TPL = ` Limit `; export default class Limit extends AbstractSearchOption { static get optionName() { return "limit" }; static get attributeType() { return "label" }; static async create(noteId) { await AbstractSearchOption.setAttribute(noteId, 'label', 'limit', '10'); } doRender() { const $option = $(TPL); this.$limit = $option.find('input[name=limit]'); this.$limit.on('change', () => this.update()); this.$limit.on('input', () => this.update()); this.$limit.val(this.note.getLabelValue('limit')); return $option; } async update() { const limit = this.$limit.val(); await this.setAttribute('label', 'limit', limit); } }