@joshfarrant/shortcuts-js
Version:
An iOS 12 Shortcuts creator
37 lines • 1 kB
JavaScript
;
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