UNPKG

@joshfarrant/shortcuts-js

Version:
41 lines 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const uuidv4 = require("uuid/v4"); const utils_1 = require("../utils"); /** * @action Repeat * @section Actions > Scripting > Control Flow * @icon Scripting * * Repeats the contained actions, running them the specified number of times. * * ```js * repeat({ * count: 10, * actions: [showAlert({}), comment({})], * }); * ``` */ const repeat = ({ actions = [], count = 1, }) => { const groupingIdentifier = uuidv4(); return [ { WFWorkflowActionIdentifier: 'is.workflow.actions.repeat.count', WFWorkflowActionParameters: { WFRepeatCount: count, GroupingIdentifier: groupingIdentifier, WFControlFlowMode: 0, }, }, ...actions, { WFWorkflowActionIdentifier: 'is.workflow.actions.repeat.count', WFWorkflowActionParameters: { GroupingIdentifier: groupingIdentifier, WFControlFlowMode: 2, }, }, ]; }; exports.default = utils_1.withActionOutput(repeat); //# sourceMappingURL=repeat.js.map