F
Filament12mo ago
TiBiBa

Alternative for emit() in v3?

Hi! When updating from v2 to v3 a custom page broke due to an emit does not exist. error. The page implements HasForms and worked fine in v2. The event was caught in the blade template like this:
Livewire.on('dataUpdated', () => {
console.log('hello!');
initializeTree();
})
Livewire.on('dataUpdated', () => {
console.log('hello!');
initializeTree();
})
Do anyone have a suggestion how to handle the same functionaliy in v3? Thanks in advance!
Solution:
livewire documentation says "emit() has been renamed to dispatch()"
Jump to solution
3 Replies
Dennis Koch
Dennis Koch12mo ago
Check the livewire upgrade guide. Emit is not a filament method.
TiBiBa
TiBiBa12mo ago
Thanks! I think it almost works. However, I can't figure out how to use the alpine way of listening to the event. Currently the following script is used:
Livewire.on('dataUpdated', () => {
console.log('hello!');
initializeTree();
})
Livewire.on('dataUpdated', () => {
console.log('hello!');
initializeTree();
})
But according to the upgrade guide I should use something like this:
x-on:event-name="callbackCode" pattern.
x-on:event-name="callbackCode" pattern.
On what element or part of the code? I'm a bit lost here.
Solution
roni
roni12mo ago
livewire documentation says "emit() has been renamed to dispatch()"