Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit 56b13b4

Browse files
committed
Add GDD Type invoke-action
A second attempt, following the dicussion in #11
1 parent 123273e commit 56b13b4

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,40 @@ Example:
422422
}
423423
```
424424

425+
### Special GDD Type: "Invoke Action"
426+
427+
Some templates support invoking custom functions during their life-time.
428+
This GDD Type should be rendered as a Button in the GUI so that the user can click it to invoke the action.
429+
430+
431+
Example:
432+
```typescript
433+
{
434+
"title": string, // [Mandatory] A short title / label of the action
435+
"description": "", // [Optional] A longer description of the action
436+
"type": "null",
437+
"gddType": "invoke-action",
438+
"gddOptions": {
439+
// [mandatory] Name of the function to execute/invoke in the template. Example: "triggerGoalAnimation"
440+
"invokeFunction": string
441+
// [optional] An array containing arguments provided to the function. Example: "myCustomHello(\"world\", $path)"
442+
"invokeArguments": ["Zlatan Ibrahimovic", 11, "$$path", "$$data"]
443+
}
444+
}
445+
```
446+
There are certain _special tokens_ that can be used in the `invokeArguments` array:
447+
448+
* `"$$data"` is a special token which will be substituted at runtime with the full template data object.
449+
450+
This is useful when an action needs the latest data.
451+
452+
* `"$$path"` is a special token which will be substituted at runtime with the [JSONPath](https://goessner.net/articles/JsonPath/) of the action.
453+
454+
This is useful when having an action inside an array, since this would cause multiple actions to render (one per row in the data).
455+
An example of a path would be `myData.people[2]` for the action in the 3rd row of an array called `people` in an object called `myData`.
456+
457+
458+
425459
## For GUI Developers
426460

427461
When implementing a GUI to support the GDD definitions, you don't have to implement support for all GDD Types - since the GDD Types are designed to degrade gracefully. The only types that are mandatory to implement are the basic types `"boolean"`, `"string"`, `"number"`, `"integer"`, `"array"`and `"object"`.

0 commit comments

Comments
 (0)