Typed timer action

commit_hash:ab171c2a345ccf16956e902019727918173da72c
This commit is contained in:
4eb0da
2024-12-23 11:45:42 +03:00
parent d3238bb62e
commit fd458a605d
5 changed files with 25 additions and 4 deletions
@@ -1123,6 +1123,19 @@
callHideTooltip(actionTyped.id, componentContext);
break;
}
case 'timer': {
if (timersController) {
timersController.execTimerAction(actionTyped.id, actionTyped.action);
} else {
log(wrapError(new Error('Incorrect timer action'), {
additional: {
id: actionTyped.id,
action: actionTyped.action
}
}));
}
break;
}
default: {
log(wrapError(new Error('Unknown type of action'), {
additional: {
+1 -1
View File
@@ -101,7 +101,7 @@ export class TimersController {
});
}
execTimerAction(id: string | null, action: string | null) {
execTimerAction(id: string | null | undefined, action: string | null | undefined) {
if (!id || !action || !this.timers.has(id) || !AVAIL_ACTIONS.has(action)) {
this.logError(wrapError(new Error('Incorrect timer action'), {
additional: {
+7 -1
View File
@@ -239,9 +239,15 @@ export interface ActionHideTooltip {
id: string;
}
export interface ActionTimer {
type: 'timer';
id: string;
action: 'start' | 'stop' | 'pause' | 'resume' | 'cancel' | 'reset';
}
export type TypedAction = ActionSetVariable | ActionArrayRemoveValue | ActionArrayInsertValue |
ActionCopyToClipboard | ActionFocusElement | ActionClearFocus | ActionDictSetValue | ActionArraySetValue |
ActionAnimatorStart | ActionAnimatorStop | ActionShowTooltip | ActionHideTooltip;
ActionAnimatorStart | ActionAnimatorStop | ActionShowTooltip | ActionHideTooltip | ActionTimer;
export interface ActionBase {
log_id: string;
+2 -1
View File
@@ -27,7 +27,8 @@
},
"platforms": [
"android",
"ios"
"ios",
"web"
],
"required": [
"type",
+2 -1
View File
@@ -2120,7 +2120,8 @@
],
"platforms": [
"android",
"ios"
"ios",
"web"
],
"expected_results": [
"The timer calls tick_actions and changes the variable with the set interval.",