Nova · Endpoints
Function endpoint
An endpoint that names a function its host has registered. call runs it with the action’s data, and what it answers is written to the endpoint’s target.
{
id: 'function-endpoint',
data: { total: { seats: 0, price: 0 } },
layout: {
component: 'Stack',
children: [
{
component: 'Text',
children: '{{$.total.seats}} seats, {{$.total.price}} in all',
},
{
component: 'Button',
ref: 'add',
children: 'Add it up',
},
],
},
endpoints: {
total: { fn: 'function-endpoint.total', target: 'total' },
},
triggers: [
{
event: 'ui:click',
ref: 'add',
do: [{ call: 'total' }],
},
],
}0 seats, 0 in all
{ function-endpoint.total: { seats: 3, price: 114 } }press add
{ total: { seats: 3, price: 114 } }3 seats, 114 in all Add it up
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.