diff --git a/index.html b/index.html index 208f873..7af21e6 100644 --- a/index.html +++ b/index.html @@ -1032,7 +1032,7 @@

On Change Example:

-
+

Custom Select:

@@ -1107,6 +1107,35 @@

On Change Example:

+
  • + Dwight Schrute + + + +
  • { - el.addEventListener(eventName, event) + [].concat(listener).forEach(({ el, eventName, event }) => { + el.addEventListener(eventName, (e) => { + this.debounce(() => { + event(e) + }, 50) }) - } else { - const { el, eventName, event } = listener - el.addEventListener(eventName, event) - } + }) } + debounce(callback, wait) { + if (this.timeout) return + clearTimeout(this.timeout) + this.timeout = setTimeout(() => { + callback() + this.timeout = null + }, wait) + } + setChangeEvent() { const el = this.entity.element const key = ':change'