feat: add throttling for text input elements

This commit is contained in:
Yohan Boniface 2024-09-03 16:53:47 +02:00
parent 33b0f6c318
commit d4ffae09da

View file

@ -241,6 +241,16 @@ L.FormBuilder.Element.include({
},
})
L.FormBuilder.Input.include({
set: function () {
// Add throttling
if (this._typing) window.clearTimeout(this._typing)
this._typing = window.setTimeout(() => {
this.builder.setter(this.field, this.toJS())
}, 300)
},
})
L.FormBuilder.Select.include({
clear: function () {
this.select.value = ''