Passing the UserEvent argument to UX

I know I can give an argument when raising a UserEvent in JavaScript.
However, this parameter is not available in UX and can only be used in other JavaScript functions.

What if we add a new DataBinding for this user event argument?
Below is my usecase.

<UserEvent ux:Name="playSound" />
<OnUserEvent EventName="playSound">
    <PlaySound File="{soundFile}"/>
</OnUserEvent>
<JavaScript>
    let player = playSound;
    module.exports = {
        soundFile:Observable();
        player:player;
    }
</JavaScript>

:

<JavaScript>
    soundFile.value = "test.wav";
    player.raise();
</JavaScript>

I am a bit nervous because I can not be sure that if I pass the argument to Observable, it will be faster than the event to change the value.

It would be better if I could do this as follows.

<UserEvent ux:Name="playSound" />
<OnUserEvent EventName="playSound">
    <PlaySound File="{Argument soundFile}"/>
</OnUserEvent>
<JavaScript>
    let player = playSound;
    module.exports = {
        player:player;
    }
</JavaScript>

:

<JavaScript>
    player.raise({soundFIle:"test.wav"});
</JavaScript>

Thank you!

Hi!

In this case i think it will be fine. What you could do instead though is to pass the file to your component as a property instead.

	<Panel ux:Class="Foo" HitTestMode="LocalBounds">
		<FileSource ux:Property="F" />
		<Clicked>
			<PlaySound File="{ReadProperty F}" />
		</Clicked>
	</Panel>
	<Foo F="about_time.wav" />

something like this.