Skip to content

Commit

Permalink
Add stop and wait actions
Browse files Browse the repository at this point in the history
  • Loading branch information
electrikmilk committed Nov 17, 2023
1 parent 136b966 commit 9f3ec72
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Date from "~/actions/date";
import Count from "~/actions/count";
import ChooseFromMenu from "~/actions/choose-from-menu";
import Math from "~/actions/math";
import Stop from "~/actions/stop";
import Wait from "~/actions/wait";

interface ActionDefinitions {
[key: string]: ActionDefinition
Expand Down Expand Up @@ -51,6 +53,8 @@ export let actions: ActionDefinitions = {
'repeat.count': Repeat,
'repeat.each': RepeatWithEach,
'math': Math,
'delay': Wait,
'exit': Stop,
};

export function actionText(text: string): HTMLElement {
Expand Down
5 changes: 5 additions & 0 deletions src/actions/stop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
title: 'Stop this shortcut',
icon: 'stop_fill',
background: '#8e8e93',
}
18 changes: 18 additions & 0 deletions src/actions/wait.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {renderActionHeader} from "~/render";
import {actions, actionText} from "~/actions";
import {renderValue} from "~/value";

interface WaitParameters {
WFDelayTime: number
}

export default {
icon: 'clock_fill',
background: '#8e8e93',
render: (container: HTMLElement, params: WaitParameters) => {
return renderActionHeader(actions['delay'],
actionText('Wait'),
renderValue(params['WFDelayTime'] + ' second' + (params['WFDelayTime'] !== 1 ? 's' : ''), '1 second'),
);
}
}

0 comments on commit 9f3ec72

Please sign in to comment.