Scripting

Table of Contents

  1. Basics
  2. Scripting Reference

Basics

Drafts includes a complete JavaScript runtime based on JavaScriptCore. Scripts are executed by including script action step in actions.

The JavaScript implementation is compatible with ECMAScript 6, and supports all general JavaScript language libraries for working with basic datatypes, such as strings, numbers, dates, arrays, and objects. The runtime is not a browser-based runtime, and does not contain DOM scripting capabilities.

Scripting Reference

Draft extends the script runtime with a number of custom objects and functions specific to working with Drafts and the underlying OS. These include tools to create, query and manipulate your drafts, work with the editor to manipulate text, call out to web services, and more. Visit the script reference site for complete documenation of objects available, and example scripts.