File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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).
You can’t perform that action at this time.
0 commit comments