mirror of
https://github.com/divkit/divkit.git
synced 2026-05-07 20:02:32 +00:00
Typed timer action
commit_hash:ab171c2a345ccf16956e902019727918173da72c
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
},
|
||||
"platforms": [
|
||||
"android",
|
||||
"ios"
|
||||
"ios",
|
||||
"web"
|
||||
],
|
||||
"required": [
|
||||
"type",
|
||||
|
||||
@@ -2120,7 +2120,8 @@
|
||||
],
|
||||
"platforms": [
|
||||
"android",
|
||||
"ios"
|
||||
"ios",
|
||||
"web"
|
||||
],
|
||||
"expected_results": [
|
||||
"The timer calls tick_actions and changes the variable with the set interval.",
|
||||
|
||||
Reference in New Issue
Block a user