Run Javascript

Run javascript, get output, supports asynchronous javascript.


Description

Library to execute javascript and get results that can be used in your shortcut.

There are two input modes, headless and visible. They serve different solutions.

Setup

When you run your javascript in headless mode you have to use document.write(...) to produce output results, so long as your javascript is synchronous you can manipulate the document that is passed as output.

If you have an asynchronous action (time-out, Ajax, etc) you have to use the visible mode which requires a manual user action to produce output. This is done by using the users clipboard as data Passthrough mechanism. (It restores the original clipboard content when it’s done). To pass results to the users clipboard in visible mode you must call shortcutResult({...}) when your script has finished its work. This will prompt the user to tap a button which will populate their clipboard.

Input accepts an array of urls for external scripts that need imported for your script to run.

Used by ShortcutML Used by ShortcutNLP

Latest Release Notes

1.0.0 - July 27, 2019, 6:09 p.m.

Initial release


Past versions