Action

Script Library

Posted by @edgauthier, Last update almost 2 years ago

Defines a function that can be used to wrap other functions and include “library” scripts before the supplied function.

Use an Include Action step to include this action first before your other action steps to use it.

Based on code provided by @draft8

Steps

  • script

    // Scripting - Library
    
    const usingLibs = f => {
      eval(
        `(() => {
          ${Draft.query("", "all", ["script", "lib"])
            .map(d => d.content)
            .join('\n\n')}
          return (${f})();
        })()`
      );
    };

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.