UNPKG

@joshfarrant/shortcuts-js

Version:
37 lines 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../utils"); /** * @action Run JavaScript on Web Page * @section Content Types > Web > Safari * @icon Safari * * Runs JavaScript on a Safari web page passed in as input * * ```js * runJavaScriptOnWebPage({ * text: ' * var result = []; * // Get all links from the page * var elements = document.querySelectorAll("a"); * for (let element of elements) { * result.push({ * "url": element.href, * "text": element.innerText * }); * } * * // Call completion to finish * completion(result); * `, * }); * ``` */ const runJavaScriptOnWebPage = ({ text = '', }) => ({ WFWorkflowActionIdentifier: 'is.workflow.actions.runjavascriptonwebpage', WFWorkflowActionParameters: { WFJavaScript: text, }, }); exports.default = utils_1.withActionOutput(runJavaScriptOnWebPage); //# sourceMappingURL=runJavaScriptOnWebPage.js.map