From 54b1a64807dccbe370682522c3cfbf71b5744d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 16 May 2021 00:07:47 +0200 Subject: s/get/get_callback_list/ --- static/binders.js | 6 +++--- static/vcal.js | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/static/binders.js b/static/binders.js index 729866f3..f6c306bd 100644 --- a/static/binders.js +++ b/static/binders.js @@ -7,7 +7,7 @@ function bind_recur(el, e) { /* todo bind default slots of rrule */ - let p = el.properties.get('rrule'); + let p = el.properties.get_callback_list('rrule'); // let rrule = el.rrule; /* add listeners to bind-rr tags */ @@ -62,7 +62,7 @@ function bind_recur(el, e) { } function bind_edit(el, e) { - let p = el.properties.get(e.dataset.property); + let p = el.properties.get_callback_list(e.dataset.property); e.addEventListener('input', function () { el.properties[e.dataset.property] = this.value; }); @@ -90,7 +90,7 @@ function bind_edit(el, e) { function bind_view(el, e) { let f = (s, v) => s.innerHTML = v.format(s.dataset && s.dataset.fmt); - el.properties.get(e.dataset.property).push([e, f]); + el.properties.get_callback_list(e.dataset.property).push([e, f]); } diff --git a/static/vcal.js b/static/vcal.js index 18b47547..0589606e 100644 --- a/static/vcal.js +++ b/static/vcal.js @@ -64,15 +64,15 @@ class VComponent { } else { if (e.classList.contains('summary')) { /* TODO transfer data from backend to frontend in a better manner */ - console.log (this.get(e.dataset.property)); + console.log (this.get_callback_list(e.dataset.property)); } let f = (s, v) => { console.log(s, v); s.innerHTML = v.format(s.dataset && s.dataset.fmt); }; - this.get(e.dataset.property).push([e, f]); + this.get_callback_list(e.dataset.property).push([e, f]); if (e.classList.contains('summary')) { - console.log (this.get(e.dataset.property)); + console.log (this.get_callback_list(e.dataset.property)); } // console.log("registreing", e, e.dataset.property, this); } @@ -82,7 +82,7 @@ class VComponent { for (let field of ['dtstart', 'dtend']) { - this.get(`--${field}-time`).push( + this.get_callback_list(`--${field}-time`).push( [el, (el, v) => { let date = this[field]; if (v == '') return; let [h,m,s] = v.split(':') @@ -90,7 +90,7 @@ class VComponent { date.setMinutes(Number(m)); date.setSeconds(0); this[field] = date; }]) - this.get(`--${field}-date`).push( + this.get_callback_list(`--${field}-date`).push( [el, (el, v) => { let date = this[field]; if (v == '') return; let [y,m,d] = v.split('-') @@ -106,7 +106,7 @@ class VComponent { NOTE if many more fields require special treatment then a general solution is required. */ - this.get(field).push( + this.get_callback_list(field).push( [el, (el, v) => { popup .querySelector(`.edit-tab input[name='${field}-time']`) .value = v.format("~H:~M"); @@ -235,7 +235,7 @@ class VComponent { if (this.dtstart) { /* [parsedate] */ // el.properties.dtstart = parseDate(el.properties.dtstart); - this.get('dtstart').push( + this.get_callback_list('dtstart').push( [el.style, (s, v) => { console.log(v); s[wide_event?'left':'top'] = 100 * (to_local(v.value) - start)/(end - start) + "%"; @@ -245,7 +245,7 @@ class VComponent { if (this.dtend) { // el.properties.dtend = parseDate(el.properties.dtend); - this.get('dtend').push( + this.get_callback_list('dtend').push( // TODO right and bottom only works if used from the start. However, // events from the backend instead use top/left and width/height. // Normalize so all use the same, or find a way to convert between. @@ -261,7 +261,7 @@ class VComponent { } // let calprop = get_property(el, 'calendar', el.dataset.calendar); - let calprop = this.get('calendar', el.dataset.calendar); + let calprop = this.get_callback_list('calendar', el.dataset.calendar); const rplcs = (s, v) => { let [_, calclass] = s.classList.find(/^CAL_/); @@ -285,7 +285,7 @@ class VComponent { default_value - default value when creating bind_to_ical - should this property be added to the icalendar subtree? */ - get(field, default_value) { + get_callback_list(field, default_value) { // let el = this.html_element; if (! this._slots[field]) { this._slots[field] = []; -- cgit v1.2.3