Skip to content

Commit 32ea12e

Browse files
committed
2 parents 8001a53 + 61fa3bc commit 32ea12e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

readme.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,25 @@ internal class RandomNumberAction : SDAction
104104
}
105105
```
106106

107+
You can also store variables inside an action, these will be local per-button.
108+
If an action is deleted and then re-created in the same position, the variable state will be maintained.
109+
110+
```cs
111+
[ActionMeta("Counter", Description = "A very basic counter.")]
112+
internal class RandomNumberAction : SDAction
113+
{
114+
115+
public int timesPressed = 0;
116+
117+
public override async Task OnKeyDown(string context, KeyDownPayload<NoSettings> keyDownEvent)
118+
{
119+
timesPressed ++;
120+
await SetTitle(timesPressed.ToString());
121+
}
122+
123+
}
124+
```
125+
107126
## External Application Integration
108127

109128
(Terminology Note: External-application may also be a plugin for an external-application).

0 commit comments

Comments
 (0)