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

Commit 0fde0f8

Browse files
authored
Merge pull request #27 from nuke99/fix-interceptWireModelAttachListener
Fix intercept wire model attach listener
2 parents 898c770 + 82559ff commit 0fde0f8

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

dist/livewire-vue.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/livewire-vue.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"main": "dist/livewire-vue.js",
33
"name": "livewire-vue",
4-
"version": "0.3.1",
4+
"version": "0.3.2",
55
"repository": {
66
"type": "git",
77
"url": "git://github.com/livewire/vue.git"

src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,21 @@ window.livewire.hook('interceptWireModelSetValue', (value, el) => {
3333
window.Vue.config.silent = originalSilent
3434
})
3535

36-
window.livewire.hook('interceptWireModelAttachListener', (el, directive, component, debounceIf) => {
36+
window.livewire.hook('interceptWireModelAttachListener', (directive, el, component, debounceIf) => {
3737
// If it's a vue component pass down the value prop.
3838
if (! el.__vue__) return
3939

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)