You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many people have requested this and I'll try again :)
I feel like this is one of the core functionalities that is missing from the Live components. That is just because of the promise that it says in the front page of Live Components "No javascript needed". :)
In my case I have filtering page that consists of actors. Everyone of them have sample selector with multiple samples and of course these are children of actor components. Entities also have relations. Then I have player component that is outside of the content DOM to keep it in every page with Turbo.
I select sample from one of the sample selectors and the push play button next to it. It emits to the player that it needs to play this specific sample. player pops up in the page and it has information about the sample, actor and plays it. Now I want to pause the sample from the player and I want to show in the sample selector that the audio is paused. My options:
I can emit from the player live component to all sample selectors with a payload of actor id that pause has been pressed, check that id in the component php and change the play to pause. (request to all sample selectors, no js)
Use the id of the sample selector in custom stimulus controller in the audio player and target only one sample selector (one request, js)
Define custom stimulus controller in sample selector to register listener for that component and emit to that listener from the player php. (one request, js)
This would add definition for the function so it can be emited to with function:modifier (or without modifier part). Basically it just registers more listeners for one component.
In my case the modifier function could return the actor Id so that I could emit from the player to one sample selector. Example: emit('pause:'.$sample->getActor()->getId())
Add required example stimulus controller(s) to documentation and why it is recommended way.
Documentation does not have this case and time to time people seem to ask how to do this because they do not want to do multiple requests.
The text was updated successfully, but these errors were encountered:
I'm aware of https://symfony.com/bundles/ux-live-component/current/index.html#emitting-only-to-components-with-a-specific-name, #2422 and there is https://symfony-devs.slack.com/archives/C01FN4EQNLX/p1734560066862169 and from that https://www.bradirby.com/difference-between-event-and-message/
Many people have requested this and I'll try again :)
I feel like this is one of the core functionalities that is missing from the Live components. That is just because of the promise that it says in the front page of Live Components "No javascript needed". :)
In my case I have filtering page that consists of actors. Everyone of them have sample selector with multiple samples and of course these are children of actor components. Entities also have relations. Then I have player component that is outside of the content DOM to keep it in every page with Turbo.
I select sample from one of the sample selectors and the push play button next to it. It emits to the player that it needs to play this specific sample. player pops up in the page and it has information about the sample, actor and plays it. Now I want to pause the sample from the player and I want to show in the sample selector that the audio is paused. My options:
Suggestions
Allow
#[LiveListener('function', modifier: 'changeFunction')
This would add definition for the function so it can be emited to with
function:modifier
(or without modifier part). Basically it just registers more listeners for one component.In my case the modifier function could return the actor Id so that I could emit from the player to one sample selector. Example:
emit('pause:'.$sample->getActor()->getId())
Add required example stimulus controller(s) to documentation and why it is recommended way.
Documentation does not have this case and time to time people seem to ask how to do this because they do not want to do multiple requests.
The text was updated successfully, but these errors were encountered: