Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

Commit 4d2e414

Browse files
committed
🐛 Added a fallback method when debounceIf is undefined
1 parent 1387714 commit 4d2e414

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ window.livewire.hook('interceptWireModelAttachListener', (directive, el, compone
4040
const hasDebounceModifier = directive.modifiers.includes('debounce')
4141
const isLazy = directive.modifiers.includes('lazy')
4242

43+
if (debounceIf == undefined) {
44+
debounceIf = (condition, callback, time) => {
45+
return condition
46+
? component.modelSyncDebounce(callback, time)
47+
: callback
48+
}
49+
}
50+
4351
el.__vue__.$on('input', debounceIf(hasDebounceModifier || ! isLazy, e => {
4452
const model = directive.value
4553
const value = e

0 commit comments

Comments
 (0)