Saturday, April 26, 2025
HomeAppleshortcuts app - What are the JSDoc varieties of the parameters handed...

shortcuts app – What are the JSDoc varieties of the parameters handed to run() in a JXA motion?

[ad_1]

After I add a Run JavaScript for Automation motion to a Shortcut that I am writing, it comes with a run() operate:

operate run(enter, parameters) {
    // Your script goes right here
    return enter;
}

When writing AppleScript in Automator, what’s the significance of “enter” and “parameters”? has a lot of responses with hyperlinks that might be considerably useful if I have been writing AppleScript, however to this point, one of the best hyperlink, The Construction of the on run Command Handler has solely this to say concerning the contents of enter:

The enter parameter comprises (in most cases) the output of the earlier motion within the workflow; it’s virtually all the time within the type of a listing.

That is much less useful than I might hope for from first-party documentation.

To date, I have been capable of determine this a lot out about what I can count on, describing all of it utilizing JSDoc varieties:

/**
 * An merchandise that's handed to an on-run handler.
 * @typedef {object} InputItem
 */

/**
 * @param {InputItem[]} enter 
 * @param {*} parameters 
 * @returns  string
 */
operate run(enter, parameters) {
    // Your script goes right here
    return enter;
}

I do know that I may return a string from the run operate, at the very least in some instances, as a result of it labored for me elsewhere.

Nonetheless, what sorts of object(s) can I count on within the enter and parameters arguments?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments