Nova · Shells

Messages

Actions on different canvases do not reach into each other. One says something on a channel with emit; any action with a message trigger for that channel hears it.

The shell, as it is written
{
  canvases: [
    { id: 'messages.till', initial: 'messages.sell' },
    { id: 'messages.board', initial: 'messages.count' },
  ],
  actions: {
    messages.sell: {
      id: 'messages.sell',
      layout: {
        component: 'Button',
        ref: 'sell',
        children: 'Sell a seat',
      },
      triggers: [
        {
          event: 'ui:click',
          ref: 'sell',
          do: [{ emit: { channel: 'messages.sold', payload: 1 } }],
        },
      ],
    },
    messages.count: {
      id: 'messages.count',
      data: { sold: 0 },
      layout: {
        component: 'Text',
        children: 'Sold tonight: {{$.sold}}',
      },
      triggers: [
        { message: 'messages.sold', do: [{ increment: 'sold' }] },
      ],
    },
  },
}
Running herepress it

Sold tonight: 0

What is done to it
press sell
press sell
What then stands on each canvas
{
  messages.till: ['messages.sell'],
  messages.board: ['messages.count'],
}
What it then says
Sell a seat
Sold tonight: 2
Output matches the expected value

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.