Extend StackState with functions

Extending StackState's capabilities using functions.

StackState is built to deal with a wide variety of different situations. StackState comes with functions to stay flexible enough to account for different types of logic.

Functions are predefined scripts that transform input into an output. Functions are called by StackState on-demand. For example, when a component changed state, some new telemetry flowed in or when the user triggered an action.

Packaging functions

Functions give power-users the ability to customize StackState fully. However, everyday users of StackState should not need to know that they exist.

StackPacks pre-package functions and automatically install functions on StackState whenever the StackPack gets installed. You can develop your function in StackState. When you are confident that it does what you want, you can export it and package it with a StackPack. Read more about it in how to create StackPacks.

Async vs synchronous functions

Functions in StackState can be either synchronous or asynchronous (async).

Function

Synchronous

Async

Baseline function

βœ…

-

Check function

βœ…

-

Component mapper function

βœ…

-

Event handler function

βœ…

-

Id extractor function

βœ…

-

Propagation functions

βœ…

βœ… (from v1.15.1)

Relation mapper function

βœ…

-

Async functions

Propagation functions can optionally be created as asynchronous (async) functions. This gives the function access to the Script APIs and allows more functions to be run in parallel.

Read more about propagation functions.

Synchronous functions

In StackState, functions are generally written in a synchronous blocking manner.

Read more about: