Andy Stark a46e16c28a [ACA-2157] Fixed structure, markup and links (#904)
* [ACA-2157] Added brief description and updated links

* [ACA-2157] Fixed broken image URL
2019-01-23 07:45:31 +00:00

1.3 KiB

Title
Title
Actions

Actions

Below are the details of the JSON properties that are used to define actions.

Name Description
id Unique identifier.
type Action type, see Application Actions for more details.
payload Action payload, a string containing value or expression.
{
  "$schema": "../../../extension.schema.json",
  "$version": "1.0.0",
  "$name": "plugin1",

  "actions": [
    {
      "id": "plugin1.actions.settings",
      "type": "NAVIGATE_URL",
      "payload": "/settings"
    },
    {
      "id": "plugin1.actions.info",
      "type": "SNACKBAR_INFO",
      "payload": "I'm a nice little popup raised by extension."
    },
    {
      "id": "plugin1.actions.node-name",
      "type": "SNACKBAR_INFO",
      "payload": "$('Action for ' + context.selection.first.entry.name)"
    }
  ]
}

Value expressions

You can use light-weight expression syntax to provide custom parameters for the action payloads.

$(<expression>)

Expressions are valid JavaScript blocks that evaluate to values.

Examples:

$('hello world')                //  'hello world'
$('hello' + ', ' + 'world')     //  'hello, world'
$(1 + 1)                        //  2
$([1, 2, 1 + 2])                //  [1, 2, 3]