I took the TodoApp sample and grouped the actions into a sub-object, as following:
module.exports = {
todoList: todoList,
titleInput: titleInput,
currentTab: currentTab,
remainingText: remainingText,
canClearCompleted: canClearCompleted,
actions:{
addItem: addItem,
deleteItem: deleteItem,
toggleAll: toggleAll,
toggleItem: toggleItem,
clearCompleted: clearCompleted,
showAll: showAll,
showActive: showActive,
showCompleted: showCompleted
}
};
And I then modified MainView.ux
accordingly:
<Button Clicked="{actions.addItem}" Width="60" Height="60" HitTestMode="LocalBoundsAndChildren">
...
<Each Items="{todoList}">
...
<Button Clicked="{actions.toggleItem}" Alignment="CenterLeft" Width="60" Height="60">
...
<Button Alignment="CenterRight" Clicked="{action.deleteItem}" Width="60" Height="60"
HitTestMode="LocalBoundsAndChildren">
...
</Each>
...
<Button ux:Name="allButton" Text="" Clicked="{actions.showAll}">
The bug: actions within the <Each>
collection trigger a JS error (“Something went wrong”) while those outside work normally.