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!