Nova · Actions
Set from
set with from copies what stands at one path to another. Here every step first keeps the count it is about to change, so one press takes it back.
{
id: 'set-from',
data: { count: 1, before: 1 },
layout: {
component: 'Stack',
children: [
{ component: 'Text', children: 'Seats: {{$.count}}' },
{
component: 'Button',
ref: 'more',
children: 'One more',
},
{ component: 'Button', ref: 'undo', children: 'Undo' },
],
},
triggers: [
{
event: 'ui:click',
ref: 'more',
do: [
{ set: 'before', from: 'count' },
{ increment: 'count' },
],
},
{
event: 'ui:click',
ref: 'undo',
do: [{ set: 'count', from: 'before' }],
},
],
}Seats: 1
press more press more press undo
{ count: 2, before: 2 }Seats: 2 One more Undo
Left: the action as the package ships it. Right: the same action running in this page, rendered with this site’s components. Below: the action run as the example specifies, on the installed package.