OmniOutliner 6.0 (v220.1.13)

Alert • Application • ApplyResult • Array • ColumnArray • Audio • Audio.Alert • Calendar • Color • ColorSpace • Column • Column.Summary • Column.Type • Console • Credentials • Crypto • Crypto.SHA256 • Crypto.SHA384 • Crypto.SHA512 • Data • DateComponents • Decimal • Device • DeviceType • Document • OutlineDocument • EditorColumnPosition • Email • Enumeration • Enumeration.Member • EnumerationMemberPosition • Error • FilePicker • FileSaver • FileWrapper • FileWrapper.ReadingOptions • FileWrapper.Type • FileWrapper.WritingOptions • Form • Form.Field • Form.Field.Checkbox • Form.Field.Date • Form.Field.MultipleOptions • Form.Field.Option • Form.Field.Password • Form.Field.String • Formatter • Formatter.Date • Formatter.Decimal • Formatter.Duration • Formatter.Date.Style • Function • Image • Item • Item.ApplyResult • ItemPosition • LanguageModel • LanguageModel.GenerationOptions • LanguageModel.Schema • LanguageModel.Session • LanguageModel.Tool • LigatureStyle • LineCap • Locale • MenuItem • MetadataKey • NamedStyle.List • NamedStylePosition • NoteDisplay • Notification • Outline • Pasteboard • Pasteboard.Item • PlugIn • PlugIn.Action • PlugIn.Handler • PlugIn.Handler.Registration • PlugIn.Library • Point • Preferences • Promise • Rect • Selection • SharePanel • Size • SortOrdering • Speech • Speech.Boundary • Speech.Synthesizer • Speech.Utterance • Speech.Voice • Speech.Voice.Gender • State • StringEncoding • Style • NamedStyle • Style.Attribute • Text • Text.FindOption • Text.Position • Text.Range • TextAlignment • TextComponent • TimeZone • Timer • ToolbarItem • Tree • Editor • TreeNode • ItemTreeNode • TypeIdentifier • URL • URL.Access • URL.Bookmark • URL.Components • URL.FetchRequest • URL.FetchResponse • URL.QueryItem • UnderlineAffinity • UnderlinePattern • UnderlineStyle • Version • WritingDirection • XML • XML.Document • XML.Document.Configuration • XML.Element • XML.WhitespaceBehavior • XML.WhitespaceBehavior.Type

 


Alert

An alert interface for displaying information to the user, blocking further interaction until the alert is dismissed.

Constructors

new Alert(title: String, message: String) → Alert

Create a new alert panel with the given title and text contents.

Instance Functions

function show(callback: Function(‍option: Number‍) or null) → Promise of Number

Displays the alert. If no options have yet been added, a default “OK” option is added. Once the user selects an option, the alert is dismissed. If a callback function was supplied, it is invoked with the zero-based index of the selected option as its argument. A Promise is returned as well, which may also be used to collect the result of the Alert.

function addOption(string: String)

Adds an option button to the alert.

Application

Instance Functions

function openDocument(from: Document or null, url: URL, completed: Function(‍documentOrError: Document or Error, alreadyOpen: Boolean‍))

Attempts to open the specified document and return a reference to it asynchronously. If the document is already open, the reference is passed along. Note that due to platform sandboxing restrictions, opening the document may fail if the application doesn’t have currently permission to access the given URL. The document, if any, that is associated with the calling script can be passed along to help grant permission to open the new document. The passed in function will be passed two argument. The first will be either either the Document or an Error. On success, the second argument is a Boolean specifying whether the document was already open.

Instance Properties

var buildVersion → Version read-only

The internal build version number for the app. See also userVersion.

var commandKeyDown → Boolean read-only

Whether the Command key is currently down.

var controlKeyDown → Boolean read-only

Whether the Control key is currently down.

var name → String read-only

Application name.

var optionKeyDown → Boolean read-only

Whether the Option key is currently down.

var platformName → String read-only

Returns a string describing the current platform, currently "iOS" or "macOS".

var shiftKeyDown → Boolean read-only

Whether the Shift key is currently down.

var userVersion → Version read-only

The user-visible version number for the app. See also buildVersion.

var version → String read-only

Deprecated: Recommend using either userVersion or buildVersion.

For backwards compatibility with existing scripts, this returns the same result as buildVersion.versionString. We recommend using either the user-visible userVersion or the internal buildVersion instead, which are more clear about which version they’re returning and provide their results as Version objects which can be semantically compared with other Version objects.

ApplyResult

Class Properties

var SkipChildren → ApplyResult read-only

The descendants of the current item are skipped.

var SkipPeers → ApplyResult read-only

The unvisited peers of the current item are skipped.

var Stop → ApplyResult read-only

The call to apply terminates with no further items being visited.

var all → Array of ApplyResult read-only

Array

The built-in JavaScript Array constructor.

ColumnArray : Array

An array of Columns.

Instance Functions

function byTitle(title: String) → Column or null

Return the first Column having the given title, or null if no such column is in the array.

Audio

Class Functions

function playAlert(alert: Audio.Alert or null, completed: Function(‍‍) or null)

Play the specified Audio.Alert. On macOS, if no alert is specified, the user’s default alert sound will be played. On iOS, there is no default alert sound and nothing will be done without specifying an alert.

Audio.Alert

Constructors

new Audio.Alert(url: URL) → Audio.Alert

Calendar

Class Properties

var buddhist → Calendar read-only

var chinese → Calendar read-only

var coptic → Calendar read-only

var current → Calendar read-only

The user’s preferred calendar

var ethiopicAmeteAlem → Calendar read-only

var ethiopicAmeteMihret → Calendar read-only

var gregorian → Calendar read-only

The Gregorian calendar.

var hebrew → Calendar read-only

var indian → Calendar read-only

var islamic → Calendar read-only

var islamicCivil → Calendar read-only

var islamicTabular → Calendar read-only

var islamicUmmAlQura → Calendar read-only

var iso8601 → Calendar read-only

var japanese → Calendar read-only

var persian → Calendar read-only

var republicOfChina → Calendar read-only

Instance Functions

function dateByAddingDateComponents(date: Date, components: DateComponents) → Date or null

Returns a new Date by adding the given DateComponents, or null if no date could be calculated.

function dateFromDateComponents(components: DateComponents) → Date or null

Returns a new Date from the given DateComponents, or null if no date could be calculated.

function dateComponentsFromDate(date: Date) → DateComponents

Returns a new DateComponents for the given Date.

function dateComponentsBetweenDates(start: Date, end: Date) → DateComponents

Returns the difference from the start Date to the end Date as a DateComponents.

function startOfDay(date: Date) → Date

Returns a Date for the first moment of the day containing the given Date according to this Calendar.

Instance Properties

var identifier → String read-only

The ISO identifier for the calendar.

var locale → Locale or null read-only

The locale of the calendar.

var timeZone → TimeZone read-only

The time zone of the calendar.

Color

Class Functions

function RGB(r: Number, g: Number, b: Number, a: Number or null) → Color

Makes a new color in the RGB colorspace, with the given components. If the alpha component is not given, 1.0 is used.

function hex(hexString: String, a: Number or null) → Color or null

Makes a new color in the RGB colorspace from the provided hexadecimal string. If the alpha component is not provided, 1.0 is used.

function HSB(h: Number, s: Number, b: Number, a: Number or null) → Color

Makes a new color in the HSB colorspace, with the given components. If the alpha component is not given, 1.0 is used.

function White(w: Number, a: Number or null) → Color

Makes a new color in the White colorspace, with the given components. If the alpha component is not given, 1.0 is used.

Class Properties

var black → Color read-only

A color in the White colorspace with white component of 0.0.

var blue → Color read-only

A color in the RGB colorspace with components (0, 0, 1, 1).

var brown → Color read-only

A color in the RGB colorspace with components (0.6, 0.4, 0.2, 1).

var clear → Color read-only

A color in the White colorspace with white component of 0.0 and alpha of 0.0 (“transparent black”).

var cyan → Color read-only

A color in the RGB colorspace with components (0, 1, 1, 1).

var darkGray → Color read-only

A color in the White colorspace with white component of 0.333.

var gray → Color read-only

A color in the White colorspace with white component of 0.5.

var green → Color read-only

A color in the RGB colorspace with components (0, 1, 0, 1).

var lightGray → Color read-only

A color in the White colorspace with white component of 0.667.

var magenta → Color read-only

A color in the RGB colorspace with components (1, 0, 1, 1).

var orange → Color read-only

A color in the RGB colorspace with components (1, 0.5, 0, 1).

var purple → Color read-only

A color in the RGB colorspace with components (1, 0, 1, 1).

var red → Color read-only

A color in the RGB colorspace with components (1, 0, 0, 1).

var white → Color read-only

A color in the White colorspace with white component of 1.0.

var yellow → Color read-only

A color in the RGB colorspace with components (1, 1, 0, 1).

Instance Functions

function blend(otherColor: Color, fraction: Number) → Color or null

Returns a new color that is a linear combination of the receiver and fraction of the other color (so, a fraction of 1.0 would just return the otherColor. If the colors cannot be blended (for example, if they cannot be converted to the same colorspace), then null is returned.

Instance Properties

var alpha → Number read-only

Returns the alpha component of the color.

var blue → Number read-only

Returns the blue component of the color, after converting to an RGB colorspace.

var brightness → Number read-only

Returns the brightness component of the color, after converting to an HSB colorspace.

var colorSpace → ColorSpace read-only

Returns the colorspace of the instance.

var green → Number read-only

Returns the green component of the color, after converting to an RGB colorspace.

var hex → String read-only

Returns a 6-character hexadecimal string for the color, after converting to an RGB colorspace (ignoring alpha).

var hue → Number read-only

Returns the hue component of the color, after converting to an HSB colorspace.

var red → Number read-only

Returns the red component of the color, after converting to an RGB colorspace.

var saturation → Number read-only

Returns the saturation component of the color, after converting to an HSB colorspace.

var white → Number read-only

Returns the white component of the color, after converting to a White colorspace.

ColorSpace

Class Properties

var CMYK → ColorSpace read-only

A colorspace with cyan, magenta, yellow, black, and alpha components.

var HSB → ColorSpace read-only

A colorspace with hue, saturation, and value (or brightness) components.

var Named → ColorSpace read-only

A space for named colors, like system defined colors, or specific color palette spaces.

var Pattern → ColorSpace read-only

A colorspace that wraps a pattern image.

var RGB → ColorSpace read-only

The sRGB colorspace with red, green, blue, and alpha components.

var White → ColorSpace read-only

A colorspace with white and alpha components.

var all → Array of ColorSpace read-only

Column

Instance Functions

function remove()

Removes a previously added column from its outline. Pre-defined columns like the outline column, note column, and status column cannot be removed. Calling remove() on them will throw an error.

Instance Properties

var enumeration → Enumeration or null read-only

If the column is a of type Column.Type.Enumeration, this returns the Enumeration of members defined for use in cells in that column.

var formatter → Formatter or null

Controls the format used to display values displayed in this column. Only some column types allow formatters, and the type of the formatter must match the type of data in the column (for example, a column with a type of Column.Type.Number should have a formatter of type Formatter.Number.

var outline → Outline read-only

var style → Style read-only

The style used for cells in this column (which may be overridden by individual rows and their cells).

var textAlignment → TextAlignment

Controls the TextAlignment of the contents of cells in the Column.

var title → String

var type → Column.Type read-only

Column.Summary

A Summary can be applied for a Column in a given Editor using its setSummaryForColumn() function. When there is a summary set, it defines a rule for calculating a value to display for a parent row, given the values in its children. Note that this calculated value is not stored in the parent Item itself and instead can be accessed by the TreeNode representing the Item within the Editor.

Class Properties

var AverageLeaves → Column.Summary read-only

Calculate the average value over the entries in the descendant Items that themselves have no children.

var Hidden → Column.Summary read-only

Hide the value in rows displayed for Items that have children.

var Maximum → Column.Summary read-only

Display the maximum value over the children of each Item.

var Minimum → Column.Summary read-only

Display the minimum value over the children of each Item.

var State → Column.Summary read-only

For Checkbox columns, calculate the state of the checkbox based off the state of the children. If all children are checked or unchecked, the parent will display a check as well. If there is a mix of children states, the parent will display a mixed state, indicated by a -.

var Total → Column.Summary read-only

Display the total of the values in the children of each Item.

Column.Type

Class Properties

var Checkbox → Column.Type read-only

var Date → Column.Type read-only

var Duration → Column.Type read-only

var Enumeration → Column.Type read-only

var Number → Column.Type read-only

var Text → Column.Type read-only

Instance Properties

var identifier → String read-only

Console

The Console allows scripts to log debugging, warning, or error information where it can be viewed in the system console or in the console output area. A single instance of Console is available to scripts as the console global variable.

Instance Functions

function log(message: Object, additional: Array of Object or null)

Appends a line to the application console formed by concatenating the given message (after converting it to a String), any additional arguments separated by spaces, and finally a newline.

function error(message: Object, additional: Array of Object or null)

function info(message: Object, additional: Array of Object or null)

function warn(message: Object, additional: Array of Object or null)

Just calls Console.log, currently.

function clear()

Clears the console in the user-visible window.

Credentials

The Credentials class allows storage of private username and password pairs, URL.Bookmark instances, and possibly other sensitive information in the future. Instances are tied to a single plug-in and single application, and may only be created in plug-ins when they are being loaded.

For example, when a PlugIn.Action is being created, you could use the following pattern:

 (() => {
     let credentials = new Credentials();

     var action = new PlugIn.Action(function(selection) {
         // ... use the captured credentials ...
     });

     return action;
 })();

Attempts to create Credential instances elsewhere will throw an error. Care should be taken to store instances in anonymous closures as above, and not pass them to or store them on other objects.

Credentials are keyed off a service identifier, which your plug-in can define however it likes.

Constructors

new Credentials() → Credentials

Creates a new Credentials instance for the currently loading plug-in. Throws an error if called outside of plug-in loading.

Instance Functions

function read(service: String) → Object or null

Looks up the current credentials for a given service identifier. If credentials have previously been stored, an object will be returned containing "user" an "password" properties.

function write(service: String, username: String, password: String)

Creates or updates an existing credential, storing the username and password for this service securely in the Keychain.

function remove(service: String)

Deletes any currently stored credentials for the specified service, either a username and password or a URL bookmark.

function readBookmark(service: String) → URL.Bookmark or null

Reads the entry for the given service identifier and attempts to return it as a URL.Bookmark, or null if no such entry exists.

function writeBookmark(service: String, bookmark: URL.Bookmark)

Stores the URL.Bookmark persistently for later access.

Crypto

Crypto provides access to some of Apple’s CryptoKit

Class Functions

function randomData(length: Number) → Data

Copy length bytes of cryptographically secure random data.

Crypto.SHA256

The SHA–256 hash function.

Constructors

new Crypto.SHA256() → Crypto.SHA256

Create a new SHA–256 digest.

Instance Functions

function update(data: Data)

Incrementally update the digest with the given data.

function finalize() → Data

Finalize any remaining digest process and return the result of the hash function.

Crypto.SHA384

The SHA–384 hash function.

Constructors

new Crypto.SHA384() → Crypto.SHA384

Create a new SHA–384 digest.

Instance Functions

function update(data: Data)

Incrementally update the digest with the given data.

function finalize() → Data

Finalize any remaining digest process and return the result of the hash function.

Crypto.SHA512

The SHA–512 hash function.

Constructors

new Crypto.SHA512() → Crypto.SHA512

Create a new SHA–512 digest.

Instance Functions

function update(data: Data)

Incrementally update the digest with the given data.

function finalize() → Data

Finalize any remaining digest process and return the result of the hash function.

Data

A generic bag of bytes. Mainly useful to be interpreted / converted to some other type.

Class Functions

function fromString(string: String, encoding: StringEncoding or null) → Data

Convert the string to a Data using the given encoding, or UTF8 if none is specified.

function fromBase64(string: String) → Data

Instance Functions

function toString(encoding: StringEncoding or null) → String

Convert to a String, assuming that this Data using the specified encoding, or UTF8 if none is given.

function toBase64() → String

Convert to a Base–64 encoded string.

Instance Properties

var length → Number read-only

Number of bytes in this data.

var toObject → Object or null read-only

DateComponents

Constructors

new DateComponents() → DateComponents

Instance Properties

var date → Date or null read-only

var day → Number or null

var era → Number or null

var hour → Number or null

var minute → Number or null

var month → Number or null

var nanosecond → Number or null

var second → Number or null

var timeZone → TimeZone or null

var year → Number or null

Decimal

The Decimal class provides support for operating on base–10 numbers, which may not be exactly representable by types like the built-in JavaScript Number class. Note that Decimal does not use the built-in arithmetic operations; for example, to add two Decimal instances, you must use the add() function.

Class Functions

function fromString(string: String) → Decimal

Parses the given string into a Decimal. If the string cannot be parsed, notANumber is returned.

Class Properties

var maximum → Decimal read-only

Returns the maximum representable Decimal value.

var minimum → Decimal read-only

Returns the minimum representable Decimal value.

var notANumber → Decimal read-only

Returns a Decimal that represents a non-number value. Any arithmetic operations involving non-number values will return notANumber.

var one → Decimal read-only

Returns a Decimal representing one.

var zero → Decimal read-only

Returns a Decimal representing zero.

Instance Functions

function toString() → String

Converts the Decimal to a String representation.

function add(number: Decimal) → Decimal

Generates a new Decimal by adding the argument and the receiver.

function subtract(number: Decimal) → Decimal

Generates a new Decimal by subtracting the argument from the receiver.

function multiply(number: Decimal) → Decimal

Generates a new Decimal by multiplying the argument and the receiver.

function divide(number: Decimal) → Decimal

Generates a new Decimal by dividing the receiver by the argument.

function compare(number: Decimal) → Number

Compares the receiver and argument. If the receiver is less than the argument, –1 is returned. If the receiver is greater than the argument, 1 is returned. Otherwise, 0 is returned. notANumber is considered less than any valid number, and equal to itself.

function equals(number: Decimal) → Boolean

Returns true if the receiver and argument represent the same number (or both are notANumber), and false otherwise.

Device

Class Properties

var current → Device read-only

The device the current application is running on.

Instance Properties

var iOS → Boolean read-only

A convenience that returns true on iPhone and iPad devices.

var iPad → Boolean read-only

A convenience that returns true only on iPad devices, but not on iPhone devices.

var mac → Boolean read-only

A convenience that returns true only on Mac devices.

var operatingSystemBuildNumber → String read-only

The build number for the current operating system version running on the device.

var operatingSystemVersion → Version read-only

The current operation system version running on the device.

var type → DeviceType or null read-only

The general type of the current device

var visionPro → Boolean read-only

A convenience that returns true only on Apple Vision Pro devices.

DeviceType

Class Properties

var all → Array of DeviceType read-only

var iPad → DeviceType read-only

An iPad

var iPhone → DeviceType read-only

An iPhone

var mac → DeviceType read-only

A Mac device

var visionPro → DeviceType read-only

An Apple Vision Pro

Document

Class Functions

function makeNew(resultFunction: Function(‍document: Document or Error‍) or null) → Promise of Document

Create a new document, which can be populated with data and then presented. On iOS, if the document is not presented by the time the resultFunction returns, it will be closed. On macOS, the document will be left around and accessible to the running script. resultFunction is executed before any functions tethered to the result Promise are executed. Returns a Promise that will yield the new document or an error.

function makeNewAndShow(resultFunction: Function(‍document: Document or Error‍) or null) → Promise of Document

Create a new document and presents it. Returns a Promise that will yield the new document or an error.

Instance Functions

function close(didCancel: Function(‍document: Document‍) or null)

Close this document. If for some reason the document cannot be closed, the didCancel function may be called at some point in the future, with the original document as the single argument. For example, on the Mac the user may review unsaved changes and may cancel the close operation. If the document is closed, the didCancel function will not be called at all.

function save()

Save this document.

function fileWrapper(type: String or null) → FileWrapper

Deprecated: Please use makeFileWrapper() instead. Returns a new FileWrapper representing the contents of the document formatted as the specified type, or its current fileType if a null is passed for the type.

function makeFileWrapper(baseName: String, type: String or null) → Promise of FileWrapper

Generates a FileWrapper representing the contents of the document formatted as the specified type, or its current fileType if a null is passed for the type. Returns a Promise that will yield the file wrapper or an error. The returned file wrapper will have a name based off the given baseName and the default path extension for the requested file type.

function undo()

Undo the last done action.

function redo()

Redo the last undone action.

function show(completed: Function(‍‍) or null)

Presents the document, ordering the window forward on macOS, and possibly closing the existing document and opening the new on on iOS. Calls the completion function once the document is shown.

function createOmniLinkURL(additionalQueryItems: Array of URL.QueryItem or null, additionalPromptMessage: String or null) → Promise of URL

Creates an Omni Link for the current document, with optional parameters for additional query items and prompt message text. Convenience cover for URL.omniLinkForFileURL().

Instance Properties

var canRedo → Boolean read-only

Whether there are currently any actions that can be redone.

var canUndo → Boolean read-only

Whether there are currently any actions that can be undone.

var fileType → String or null read-only

The file type identifier the document uses when saving, if set.

var fileURL → URL or null read-only

The location of the document’s on-disk representation.

var name → String or null read-only

Document name.

var omniLink → URL or null read-only

The Omni Link for this document, when the document is already saved within a Connected Folder.

var writableTypes → Array of String read-only

A list of all of the file types that this document can be written as.

OutlineDocument : Document

Instance Properties

var editors → Array of Editor read-only

var outline → Outline read-only

EditorColumnPosition

Email

A set of parameters for generating an email.

Constructors

new Email() → Email

Instance Functions

function generate()

Presents the generated email to the user for them to send (or discard). On iOS, any included attachment FileWrappers that are directories will be converted to Zip files.

Instance Properties

var blindCarbonCopy → String or Array of String or null

var body → String or null

var carbonCopy → String or Array of String or null

var fileWrappers → Array of FileWrapper

var receiver → String or Array of String or null

var subject → String or null

Enumeration

Instance Functions

function memberNamed(name: String) → Enumeration.Member or null

Returns the Enumeration.Member with specified name, or null if no member has the given name.

function add(name: String or null, at: EnumerationMemberPosition or null) → Enumeration.Member

Adds a new Enumeration.Member to the Enumeration, using the specified name if it is unused (otherwise a unique name is selected automatically). A Enumeration.Member.Position may be specified to determine where in the list of members the new member is located.

function move(members: Array of Enumeration.Member, to: EnumerationMemberPosition)

Moves the Enumeration.Members to the requested position.

Instance Properties

var beginning → EnumerationMemberPosition read-only

Returns an Enumeration.Member.Position that indicates the position before any other members.

var end → EnumerationMemberPosition read-only

Returns an Enumeration.Member.Position that indicates the position before after existing children.

var members → Array of Enumeration.Member read-only

Returns the sorted list of Enumeration.Members contained in this Enumeration.

Enumeration.Member

Instance Functions

function remove()

Instance Properties

var after → EnumerationMemberPosition read-only

Returns an Enumeration.Member.Position that indicates the position just after this member.

var before → EnumerationMemberPosition read-only

Returns an Enumeration.Member.Position that indicates the position just before this member.

var name → String read-only

EnumerationMemberPosition

Error

The built-in JavaScript Error constructor.

Instance Properties

var causedByUserCancelling → Boolean read-only

Returns true for errors that are caused by the user cancelling an operation. For example, if the user selects the Cancel button in a FilePicker, the Promise will signal an error that reflects this.

FilePicker

A FilePicker allows the user to select URLs for files via the system-supplied file picking interface.

Constructors

new FilePicker() → FilePicker

Returns a new FilePicker with default settings.

Instance Functions

function show() → Promise of Array of URL

Presents the system file selection interface to the user, allowing them to choose one or more files of the given types. The returned Promise will yield the chosen URLs on success. If the user cancels chosing, the Promise will be rejected. Note that even when picking a single file or folder, the result will be an array of URLs.

Instance Properties

var folders → Boolean

If true, then folders may be selected, but not files. In this case, types is ignored. Defaults to false.

var message → String

A message to display describing what files are being picked. This is currently only supported on macOS.

var multiple → Boolean

If true, then multiple files may be selected. Defaults to false.

var types → Array of TypeIdentifier or null

The file types that will be allowed. If null, all file types will be allowed. Defaults to null.

FileSaver

A FileSaver allows the user to save a FileWrapper to a URLs via the system-supplied file picking interface.

Constructors

new FileSaver() → FileSaver

Returns a new FileSaver with default settings.

Instance Functions

function show(fileWrapper: FileWrapper) → Promise of URL

Presents the system file saving interface to the user, allowing them to choose a location and file name to save the file wrapper. The returned Promise will yield the chosen URL on success. If the user cancels chosing, the Promise will be rejected.

Instance Properties

var message → String

A message to display describing what file is being saved. This is currently only supported on macOS.

var nameLabel → String

The label shown next to the user-editable file name field. This is currently only supported on macOS.

var prompt → String

The prompt shown on the the save button. This is currently only supported on macOS.

var types → Array of TypeIdentifier or null

The file types that will be allowed. If null, all file types will be allowed. Defaults to null.

FileWrapper

Class Functions

function withContents(name: String or null, contents: Data) → FileWrapper

Returns a new FileWrapper that represents a flat file containing the given data.

function withChildren(name: String or null, children: Array of FileWrapper) → FileWrapper

Returns a new FileWrapper that represents a directory with the given child file wrappers. Each child file wrapper must have a unique name specified.

function fromURL(url: URL, options: Array of FileWrapper.ReadingOptions or null) → FileWrapper

Reads a FileWrapper from an existing URL.

Instance Functions

function childNamed(name: String) → FileWrapper or null

Returns the child file wrapper with the specified name, or null if the receiver is not a directory or doesn’t have a child with that name.

function filenameForChild(child: FileWrapper) → String or null

Returns the unique file name that will be used for the given child FileWrapper, or null if this file wrapper is not a child of the receiver.

function write(url: URL, options: Array of FileWrapper.WritingOptions or null, originalContentsURL: URL or null)

Writes the FileWrapper to the given URL. NOTE: Any existing file or folder at the desination URL will be replaced. Care must be taken when developing scripts to avoid unintended data loss.

Instance Properties

var children → Array of FileWrapper read-only

Returns an Array of child FileWrappers, if this represents a directory. Otherwise, an empty array is returned.

var contents → Data or null read-only

Returns the regular file contents of the wrapper, if this represents a regular file. Otherwise, null is returned.

var destination → URL or null read-only

Returns the destination if this represents a symbolic link. Otherwise, null is returned.

var filename → String or null

Returns the actual file name that was last read for this file wrapper. Depending on the names of other sibling wrappers, this may not be what file name will be written.

var preferredFilename → String or null

Returns the preferred file name that should be used when writing the file wrapper if no other file in the same parent directory wrapper is in use.

var type → FileWrapper.Type read-only

Returns the type of this FileWrapper.

FileWrapper.ReadingOptions

Class Properties

var Immediate → FileWrapper.ReadingOptions read-only

Whether the contents are read immediately, or (by default) as the file wrappers are accessed.

var WihtoutMapping → FileWrapper.ReadingOptions read-only

Allow disabling file mapping.

var all → Array of FileWrapper.ReadingOptions read-only

FileWrapper.Type

Class Properties

var Directory → FileWrapper.Type read-only

A FileWrapper that represents a directory with zero or more child wrappers.

var File → FileWrapper.Type read-only

A FileWrapper that represents a regular file with data contents.

var Link → FileWrapper.Type read-only

A FileWrapper that represents a symbolic link to another location.

var all → Array of FileWrapper.Type read-only

FileWrapper.WritingOptions

Class Properties

var Atomic → FileWrapper.WritingOptions read-only

Write the entire FileWrapper atomically, so that either the entire file package is replaced or none of it is.

var UpdateNames → FileWrapper.WritingOptions read-only

On successful writing, update the filename of each file wrapper recursively so that following writes can use performance optimizations using hard links.

var all → Array of FileWrapper.WritingOptions read-only

Form

Form provides a mechanism to collect input from the user. Each form contains one or more instances of subclasses of Field, which are given a key. As the form is filled out, values object is populated with the values from the user interface.

Constructors

new Form() → Form

Instance Functions

function addField(field: Form.Field, index: Number or null)

Adds the new Field to the Form, at the indicated position, or at the end if no position is specified. If the field has a default value, it will be added to the values result object immediately.

function removeField(field: Form.Field)

Removes the Field from theForm. Any entry in thevalues` for this field will be removed as well.

function show(title: String, confirmTitle: String) → Promise of Form

Present the Form to the user, and return a Promise to be fullfilled or rejected when the user commits or cancels the form.

Instance Properties

var fields → Array of Form.Field read-only

The current Field instances in the form, which will be visible to the user entering input.

var validate → Function(‍Form: Form‍) → Boolean or null

A function to check whether the entered values are acceptable. The form to validate is passed as the argument and the function is expected to return a boolean result or null to perform default validation. If an Error is thrown, it’s message will be displayed in the form as the reason for validation failure. Note that the validation function may add or remove fields and update entries in the values object (which will cause the interface to be updated). This is called any time the user edits values, or a field is added or removed. If no validate function is specified or it returns null, some per-field default validation will be performed (see Form.Field.Option. If the validate function returns a boolean result, no default validation will be performed.

var values → Object read-only

An object with the collected values for each field, stored under the key for that field.

Form.Field

A single entry for a user input value in a Form. Each field can only be added to a single Form. This class cannot be constructed directly.

Instance Properties

var displayName → String or null read-only

Human readable string used as the label for this field.

var key → String read-only

Key to use when storing the value for this field in the containing form’s values object.

Form.Field.Checkbox : Form.Field

Constructors

new Form.Field.Checkbox(key: String, displayName: String or null, value: Boolean or null) → Form.Field.Checkbox

Returns a new Checkbox field, optionally with an initial value (which will be false if no value is specified).

Form.Field.Date : Form.Field

Constructors

new Form.Field.Date(key: String, displayName: String or null, value: Date or null, formatter: Formatter.Date or null) → Form.Field.Date

Returns a new Date field, optionally with an initial value, and optionally a date formatter. If no formatter is specified, a default one will be created that follows the user’s date formatting preferences to display and determine component ordering when parsing dates. Relative dates like “1d”, “tomorrow”, “now” can also be entered.

Form.Field.MultipleOptions : Form.Field

Constructors

new Form.Field.MultipleOptions(key: String, displayName: String or null, options: Array of Object, names: Array of String or null, selected: Array of Object) → Form.Field.MultipleOptions

Returns a new MultipleOptions field, allowing the user to pick multiple items from a list of option objects. A list of names may also be given, which must have the same length as the options array if so. If no names are given, the objects are converted to strings for display. An array of zero or more initially selected objects (which must be members of the options array) may also be given. An empty array is valid input for the initially selected items. Additionally, it is valid for MultipleOptions fields to have a value that is an empty array.

Form.Field.Option : Form.Field

Constructors

new Form.Field.Option(key: String, displayName: String or null, options: Array of Object, names: Array of String or null, selected: Object or null, nullOptionTitle: String or null) → Form.Field.Option

Returns a new Option field, allowing the user to pick from a list of option objects. A list of names may also be given, which must have the same length as the options array if so. If no names are given, the objects are converted to strings for display. An initially selected object (which must be a member of the options array) may also be given. If the field is not configured to allow a null value and no initially selected value is specified, the user must select a value before the field is considered valid under the default form validation.

Instance Properties

var allowsNull → Boolean

If set to true, an option will be added to allow selecting null.

var nullOptionTitle → String or null

If null is allowed, this will be used for the title of that option. Otherwise a default title will be used.

Form.Field.Password : Form.Field

A field for text-based input, optionally using a Formatter to convert the string value into a different type.

Constructors

new Form.Field.Password(key: String, displayName: String or null, value: String or null) → Form.Field.Password

Returns a new Password field, optionally with an initial value. The displayed text will be obscured.

Form.Field.String : Form.Field

A field for text-based input, optionally using a Formatter to convert the string value into a different type.

Constructors

new Form.Field.String(key: String, displayName: String or null, value: Object or null, formatter: Formatter or null) → Form.Field.String

Returns a new String field, optionally with an initial value and formatter. If a formatter is specified, the value should be of the output type from the formatter or null. If no formatter is specified, the value should be a string or null.

Formatter

Formatter.Date : Formatter

Class Functions

function withStyle(dateStyle: Formatter.Date.Style, timeStyle: Formatter.Date.Style or null) → Formatter.Date

A formatter that will display dates according to the specified date and time formats selected in system settings.

function withFormat(format: String) → Formatter.Date

Returns a formatter with a specific ICU date format and the user’s current locale, calendar, and timeZone. See http://userguide.icu-project.org/formatparse/datetime/ for details on date format strings.

Class Properties

var iso8601 → Formatter.Date read-only

Return a date formatter that produces ISO–8601 formatted dates, using the Gregorian calendar and the UTC time zone.

Instance Functions

function stringFromDate(date: Date) → String

function dateFromString(string: String) → Date or null

Instance Properties

var calendar → Calendar

var dateFormat → String read-only

var locale → Locale

var timeZone → TimeZone

Formatter.Decimal : Formatter

This formatter class formats and parses Decimal-valued strings (note, not Number values).

Class Functions

function currency(code: String or null) → Formatter.Decimal

Returns a new formatter that will display the value as a currency value. An ISO currency code may be specified to pick a specific currency, or null may be passed to use the default currency for the user’s locale. If the argument is not a valid currency code, an error will be thrown.

Class Properties

var currencyCodes → Array of String read-only

Deprecated: Please use the currencyCode property on Locale instead. Returns the list of known ISO currency codes

var custom → Formatter.Decimal read-only

Returns a new formatter that can be configured with custom settings.

var decimal → Formatter.Decimal read-only

Returns a new number formatter that will use both a decimal separator.

var percent → Formatter.Decimal read-only

Returns a new number formatter that will display the value as a percentage.

var percentWithDecimal → Formatter.Decimal read-only

Returns a new number formatter that will display the value as a percentage with a decimal separator.

var plain → Formatter.Decimal read-only

Returns a new number formatter that will not use any separators.

var thousandsAndDecimal → Formatter.Decimal read-only

Returns a new number formatter that will use both a thousands and decimal separator.

Instance Functions

function stringFromDecimal(number: Decimal) → String or null

Format a Decimal as a string, based on the rules set on the formatter.

function decimalFromString(string: String) → Decimal or null

Parses a Decimal from a string, based on the rules set on the formatter. Returns null if the value was not recognized.

Instance Properties

var decimalSeparator → String

The string to display between the whole portion of a number and the decimal portion.

var negativeFormat → String

A format string to use for negative values.

var positiveFormat → String

A format string to use for positive values.

var thousandsSeparator → String or null

The string to display between groups of digits representing powers of a thousand.

var zeroSymbol → String or null

The string to use when displaying a zero value. If this is null, the positiveFormat is used.

Formatter.Duration : Formatter

Constructors

new Formatter.Duration() → Formatter.Duration

Instance Functions

function stringFromDecimal(number: Decimal) → String or null

function decimalFromString(string: String) → Decimal or null

Instance Properties

var hoursPerDay → Number

var hoursPerWeek → Number

var useVerboseFormat → Boolean

Formatter.Date.Style

Class Properties

var Full → Formatter.Date.Style read-only

Use the user’s “full” format as selected in system settings.

var Long → Formatter.Date.Style read-only

Use the user’s “long” format as selected in system settings.

var Medium → Formatter.Date.Style read-only

Use the user’s “medium” format as selected in system settings.

var Short → Formatter.Date.Style read-only

Use the user’s “short” format as selected in system settings.

var all → Array of Formatter.Date.Style read-only

Function

The built-in JavaScript Function constructor.

Image

Class Functions

function symbolNamed(name: String) → Image or null

Returns an image given a symbol name.

Item

Instance Functions

function setValueForColumn(value: Object or null, column: Column)

Assigns a new value or clears the value for the cell defined by the intersection of this Item and the specified Column.

function valueForColumn(column: Column) → Object or null

Returns the current value (or null) for the cell defined by the intersection of this Item and the specified Column.

function addChild(position: ItemPosition or null, configure: Function(‍child: Item‍) or null) → Item

Adds a new Item as a child of this item, at the specified position. If no position is specified, the child is added after any existing children. An optional Function, taking an Item argument, may be passed to configure properties on the item before it is added to the parent). Returns the added Item.

function remove()

Removes the Item from its parent. Attempting to remove the rootItem of an Outline will throw an error.

function apply(function: Function(‍item: Item‍) → Item.ApplyResult or null)

Calls the supplied Function for each Item in the receiver (including the receiver), passing that item as the single argument. The function may optional return a Item.ApplyResult to stop or skip some of the items. Any other return value (including none) will continue the application of the function to the remaining items.

Instance Properties

var after → ItemPosition read-only

Returns an ItemPosition that indicates the slot after this item.

var ancestors → Array of Item read-only

Returns a list of all the ancestors of this item, up to but not including the root item of the Outline.

var before → ItemPosition read-only

Returns an ItemPosition that indicates the slot before this item.

var beginning → ItemPosition read-only

Returns an ItemPosition that indicates the position before any existing children.

var children → Array of Item read-only

Returns the list of items contained by this Item. Note that if the Editor has sort orderings specified, or there is a filter in place, the order and number of items returned here may differ from what is seen at the Tree level.

var childrenAreSections → Boolean

Control whether the receiver’s children are sections or not. Setting this to true will expand the item (and its ancestors) in the sidebar.

var descendants → Array of Item read-only

Returns a breadth-first ordered array of all the descendants of this Item.

var descendents → Array of Item read-only

DEPRECATED: Old spelling for descendants.

var end → ItemPosition read-only

Returns an ItemPosition that indicates the position before after existing children.

var followingSiblings → Array of Item read-only

Returns an array of all the Items that share the same parent that are also ordered after this Item.

var hasChildren → Boolean read-only

Returns true if the Item has sub-items.

var identifier → String read-only

The identifier for this Item, which is unique within the containing Outline. The root item will always report an empty String.

var index → Number read-only

Returns the index of this Item among its siblings, or zero for the rootItem.

var leaves → Array of Item read-only

Returns a list of all the items contained by this Item that have no children. If this item has no children, an empty array is returned (an Item isn’t considered its own leaf).

var level → Number read-only

Returns the nesting level of the Item, relative to the root of the item tree. The rootItem of an Outline has level zero, its children have level one, and so on.

var note → String

A convenience to access the value in the note column for the item.

var outline → Outline read-only

var parent → Item or null read-only

Returns the item that contains this item, or null if this is the root item.

var precedingSiblings → Array of Item read-only

Returns an array of all the Items that share the same parent that are also ordered before this Item.

var sections → Array of Item read-only

Returns a list of the items under this time that are considered sections. These are the top-level items which are expanded in the sidebar.

var state → State or null

The status of the row (which maps to the Outline’s statusColumn). Note that summaries are applied at the Tree level, so automatically calculated status values for items with children will not be reflected in this property. A null status indicates that the checkbox is disabled for this item, and if a summary is enabled for the column, this item does not contribute to the calculation.

var style → Style read-only

The style for this Item, which itself cascades from the Style for the entire Outline.

var topic → String

A convenience to access the value in the outline column for the item. The result will be a String, no matter what type the outline column is configured to use.

Item.ApplyResult

Class Properties

var Skip → Item.ApplyResult read-only

The descendants of the current Item are skipped.

var Stop → Item.ApplyResult read-only

The call to Item.apply terminates with no further items being processed.

var all → Array of Item.ApplyResult read-only

ItemPosition

LanguageModel

LanguageModel.GenerationOptions

Constructors

new LanguageModel.GenerationOptions() → LanguageModel.GenerationOptions

Instance Properties

var maximumResponseTokens → Number or null

See Apple’s documentation for maximumResponseTokens.

LanguageModel.Schema

When working with a LanguageModel, you typically provide text input and get text back as a response. The LanguageModel.Schema class guides the structure of the response, so you can results which are in a format that you expect.

For example, if you’d like the language model to return an array of steps, each of which has a title, a description, and a priority, you might write:

 (async () => {
    const schema = LanguageModel.Schema.fromJSON({
        arrayOf: {
            name: "step-schema",
            properties: [
                {name: "title"},
                {name: "description", isOptional: true},
                {name: "priority", schema: {
                    name: "priority-schema", anyOf: [{constant: "high"}, {constant: "low"}]
                }},
                {name: "childSteps", description: "A breakdown of steps.", isOptional: true, schema: {arrayOf: {referenceTo: "step-schema"}, minimumElements: 1}}
            ]
        }
    });
    const prompt = 'Provide a list of steps required to add solar power to your home.';
    console.log(prompt);
    const session = new LanguageModel.Session();
    let options = new LanguageModel.GenerationOptions()
    options.maximumResponseTokens = 4096;
    const responseJSON = await session.respondWithSchema(prompt, schema);
    console.log(responseJSON);
    const response = JSON.parse(responseJSON);
    console.log(response.map(item => item.title + ":" + item.priority));
 })()

Here’s some sample output from the final statement in the above script:

 Research and Planning:high,Choose a Location:high,Get Permits and Approvals:high,Select Solar Panels and Inverter:high,Hire a Professional Installer:high,Install Solar Panels:high,Connect to the Electrical System:high,Monitor and Maintain:low

This example demonstrates several different schema nodes:

The resulting JSON is parsed back into an object graph using JSON.parse(), at which point you can walk the object graph and its expected properties (as demonstrated by the final console.log() statement).

Class Functions

function fromJSON(json: Object) → LanguageModel.Schema

Returns a LanguageModel.Schema based on the provided JSON schema. Schemas can be named and recursively referenced.

LanguageModel.Session

Class Functions

function withTools(tools: Array of LanguageModel.Tool, instructions: String or null) → LanguageModel.Session

Creates a new instance, providing tools

Constructors

new LanguageModel.Session(instructions: String or null) → LanguageModel.Session

Creates a new instance.

Instance Functions

function respond(prompt: String) → Promise of String

Produces a text response to a prompt.

function respondWithSchema(prompt: String, schema: LanguageModel.Schema, generationOptions: LanguageModel.GenerationOptions or null) → Promise of String

Produces a JSON response to a prompt using the provided schema.

LanguageModel.Tool

When working with a LanguageModel, you can provide tools that it can use to obtain information or make calculations that haven’t been provided through its training data or the current session’s prompt history. For example, if you’d like to provide a tool to assist the model with dates, you might write something like this:

 const dateFormatter = Formatter.Date.withStyle(Formatter.Date.Style.Medium)
 const dateTool = new LanguageModel.Tool("getDate", "Parses the specified date and time and returns a date. Can specify \"today\" for today's date.", null, async (input) => {
     console.log("DEBUG: dateTool:", JSON.stringify(input));
     const inputText = input.text;
     const result = dateFormatter.dateFromString(inputText || "now");
     console.log("DEBUG: dateTool: ->", JSON.stringify(result));
     return result;
 });

The definition of a tool has several parameters:

Constructors

new LanguageModel.Tool(name: String, description: String, inputSchema: LanguageModel.Schema or null, function: Function) → LanguageModel.Tool

Creates a new instance.

LigatureStyle

Class Properties

var All → LigatureStyle read-only

Use all of the available ligatures.

var Essential → LigatureStyle read-only

Use ligatures that are required for proper rendering of text.

var Standard → LigatureStyle read-only

Use the default ligatures for the given script.

var all → Array of LigatureStyle read-only

LineCap

Class Properties

var Butt → LineCap read-only

The line has a flat end cap, exactly at the end point of the line.

var Round → LineCap read-only

The line has a round end cap, with the center at the end point of the line, and radius of half its width.

var Square → LineCap read-only

The line has a flat end cap, extending half the line width past the end point.

var all → Array of LineCap read-only

Locale

Class Properties

var identifiers → Array of String read-only

The list of known ISO locale identifiers.

Constructors

new Locale(identifier: String) → Locale

Instance Properties

var calendar → Calendar read-only

The calendar for the locale.

var currencyCode → String or null read-only

The currency code for the locale.

var identifier → String read-only

The ISO locale identifier for this object.

MenuItem

Instance Properties

var checked → Boolean

If true, a checkmark is displayed next to the MenuItem’s label.

var image → Image or null

An optional image to be displayed with the MenuItem.

var label → String

The string displayed to describe the MenuItem’s action.

MetadataKey

This class provides built-in keys for use with the metadataValue() and setMetadataValue() functions on the Outline class.

Class Properties

var authors → String read-only

The author, or authors, of the contents of the file. Value should be an array of Strings.

var comments → String read-only

Comments associated with this file. Value should be a String.

var copyright → String read-only

The copyright owner of the file contents. Value should be a String.

var description → String read-only

A description of the content of the resource. The description may include an abstract, table of contents, reference to a graphical representation of content or a free-text account of the content. Value should be a String.

var keywords → String read-only

Keywords associated with this file. For example, “Birthday”, “Important”, etc. Value should be an array of Strings.

var languages → String read-only

Indicates the languages of the intellectual content of the resource. Recommended best practice for the values of the Language element is defined by RFC 3066. Value should be an array of Strings.

var opmlDateModifiedOverride → String read-only

An override for the date modified field in an OPML document. Value should be a String in HTTP date format.

var opmlEncoding → String read-only

The document encoding for archiving an OPML document. Value should be a String.

var organizations → String read-only

The company or organization that created the document. Value should be an array of Strings.

var projects → String read-only

The list of projects that this file is part of. For example, if you were working on a movie all of the files could be marked as belonging to the project “My Movie”. Value should be an array of Strings.

var subject → String read-only

Subject of this item. Value should be a String.

var version → String read-only

The version number of this file. Value should be a String.

NamedStyle.List

Instance Functions

function add(name: String or null) → NamedStyle

Makes a new NamedStyle at the end of the NamedStyleList, and optionally assigns it a name.

function byName(name: String) → NamedStyle or null

Returns the first named style that has the specified name, or null if none do.

function byIdentifier(identifier: String) → NamedStyle or null

Returns the single named style with the specified identifier, or null if no style has that identifier.

function moveStyles(styles: Array of NamedStyle, position: NamedStylePosition)

Reorders the named styles within the NamedStyleList. This cannot be used to move styles between documents.

function duplicateStyles(styles: Array of NamedStyle, position: NamedStylePosition) → Array of NamedStyle

Instance Properties

var all → Array of NamedStyle read-only

Returns the list of all NamedStyles. Note that the order determine which attribute values are applied if two named styles have conflicting settings.

var beginning → NamedStylePosition read-only

Returns a NamedStylePosition that indicates the position before any existing named styles.

var end → NamedStylePosition read-only

Returns a NamedStylePosition that indicates the position before after existing named styles.

NamedStylePosition

NoteDisplay

Class Properties

var Inline → NoteDisplay read-only

Display notes inline with the row.

var Pane → NoteDisplay read-only

Display notes in a separate pane.

var all → Array of NoteDisplay read-only

Notification

Constructors

new Notification(title: String) → Notification

Instance Functions

function show() → Promise of Notification

Attempts to present the notification and returns a Promise which will yield the notification object itself if it is clicked or tapped, or an error if it cannot be presented or is dismissed.

Instance Properties

var subtitle → String or null

var title → String

Outline

Instance Functions

function itemWithIdentifier(identifier: String) → Item or null

Finds the Item with the specified identifier, if it exists in this Outline.

function addColumn(columnType: Column.Type, position: EditorColumnPosition, configure: Function(‍column: Column‍) or null) → Column

Adds a column to the outline at the specified position. An optional function, taking a Column argument, may be passed to configure properties on the column before it is added to the outline). Returns the added column.

function moveColumns(columns: Array of Column, position: EditorColumnPosition)

Moves the indicated columns in the editor. Note that moving the built-in statusColumn doesn’t do anything useful since its position is pinned relative to the outlineColumn (and using it as a reference in the EditorColumnPosition won’t behave as expected either).

function moveItems(items: Array of Item, position: ItemPosition)

Moves the specified Items to the new position, which must be in the same Outline.

function duplicateItems(items: Array of Item, position: ItemPosition)

Duplicates an array of Items to a destination location, which must be within the same Outline. This does a deep copy of the item tree and all the values in each Item. The rootItem may not be duplicated.

function levelStyle(depth: Number) → Style

Returns the level style for the specified nesting level, possibly extending the levelStyles array.

function group(items: Array of Item) → Item or null

Makes a new item with the specified items as its children.

function ungroup(items: Array of Item)

function invertColors()

If dynamic theming is enabled, invertColors makes the dark mode colors appear in light mode and vice versa. If dynamic theming is disabled, invertColors will use any saved (but not active) color values specified for the opposite of the outline’s current appearance, or will generate an inverse color if no such value is available.

function enableDynamicThemingUsingCurrentColorsForDarkMode(useCurrentColorsForDarkMode: Boolean)

Does nothing if dynamicThemingEnabled is true. When enabling dynamic theming, you must choose whether the outline’s current colors are displayed in light mode or dark mode. When enabling dynamic theming, colors without a specified value for the opposite mode will have one generated for them.

function disableDynamicTheming(retainDarkModeColors: Boolean)

Does nothing if dynamicThemingEnabled is false. When disabling dynamic theming, you must choose which color scheme the outline retains in its static appearance.

function organize(items: Array of Item, byColumns: Array of Column, underItem: Item, pruneEmptyGroups: Boolean or null)

* Rearranges the item trees rooted at items based on the values in the specified columns (converted to a string representation), and places those items under the specified new parent item. Any items moving to the new parent will be placed at the end of the parent item. If pruneEmptyGroups is true, any children of underItem that end up empty will be removed. As an example, assume you have a document with a enumeration column named “Type”:

     // Rearrange the leaf items into groups based on their value in the Type column.
     // Any previously created Type groups that have no entries will be removed.
     organize(rootItem.leaves, [columns.byTitle("Type")], rootItem, true)



function topItems(items: Array of Item) → Array of Item

Given an array of Items in this Outline, return the subset of Items that are not descendants of some other element of the array.

function bottomItems(items: Array of Item) → Array of Item

Given an array of Items in this Outline, return the subset of Items that are not ancestors of some other element of the array.

function itemsSortedByPosition(items: Array of Item) → Array of Item

Given an array of Items in this Outline, return a sorted array of those Items as they are ordered in the Outline’s item tree.

function metadataValue(key: String) → Object or null

Gets the metadata value for the provided key. Built-in keys are listed under MetadataKey.

function setMetadataValue(value: Object or null, key: String)

Sets the metadata value for the provided key. Built-in keys are listed under MetadataKey, and values should conform to the documented types listed there. For custom keys, the type of the value should valid for storage in an XML property list.

function onCellChanged(handler: PlugIn.Handler) → PlugIn.Handler.Registration or null

Registers a PlugIn.Handler to be called when any cell in the Outline is edited.

Instance Properties

var alternateRowColor → Color or null

var app → Application read-only

Returns the shared Application.

var backgroundColor → Color

var baseStyle → Style read-only

The default style used for the whole outline.

var columnTitleStyle → Style read-only

var columns → ColumnArray read-only

Returns an array of all the columns in the Outline, in an unspecified order.

var console → Console read-only

Returns the shared Console.

var document → OutlineDocument or null read-only

The Document that wraps this Outline, if any. Most Outlines will be contained in a document, but an outline might exist purely in memory for some period.

var dynamicThemingEnabled → Boolean read-only

var horizontalGridColor → Color or null

var levelStyles → Array of Style read-only

Returns the styles used by default for Items at different nesting levels in the document. The length of this array will be the larger of the currently defined number of level styles or the maximum nesting level of Items in the Outline.

var namedStyles → NamedStyle.List read-only

var noteColumn → Column read-only

Returns the built-in note column for the outline. Cannot be removed.

var outlineColumn → Column read-only

Returns the built-in column for the outline which displays the nesting of items. Cannot be removed.

var plugIns → Array of PlugIn read-only

Returns the set of PlugIns available to this document.

var rootItem → Item read-only

Returns the root item of the outline. This item isn’t displayed in the document, but is the parent of all the “top level” items.

var statusColumn → Column read-only

Returns the built-in checkbox column for the outline. Cannot be removed.

var styleAttributes → Array of Style.Attribute read-only

var verticalGridColor → Color or null

Pasteboard

A pasteboard temporarily holds representations of items of different types for transfer between different applications or different locations in the application.

Class Functions

function makeUnique() → Pasteboard

Creates a new unique pasteboard.

Class Properties

var general → Pasteboard read-only

The Pasteboard used for user-initiated copy/paste support.

Instance Functions

function availableType(types: Array of TypeIdentifier) → TypeIdentifier or null

The first type from the provided list which is available on the pasteboard, or null if none are available.

function addItems(items: Array of Pasteboard.Item)

Appends the new items to the pasteboard.

function clear()

Remove all items from the pasteboard.

function dataForType(type: TypeIdentifier) → Data or null

The Data representation for the given type in this pasteboard, or null if none is available.

function setDataForType(data: Data, type: TypeIdentifier)

Set the Data representation for the given type in this pasteboard, replacing any previously set data.

function stringForType(type: TypeIdentifier) → String or null

The String representation for the given type in this pasteboard, or null if none is available.

function setStringForType(string: String, type: TypeIdentifier)

Set the String representation for the given type in this pasteboard, replacing any previously set data.

Instance Properties

var URL → URL or null

Gets or sets the pasteboard content as a single URL.

var URLs → Array of URL or null

Gets or sets the pasteboard content as a list of URLs.

var color → Color or null

Gets or sets the pasteboard content as a single color.

var colors → Array of Color or null

Gets or sets the pasteboard content as a list of colors.

var hasColors → Boolean read-only

Returns true if the pasteboard contains one or more colors.

var hasImages → Boolean read-only

Returns true if the pasteboard contains one or more images.

var hasStrings → Boolean read-only

Returns true if the pasteboard contains one or more strings.

var hasURLs → Boolean read-only

Returns true if the pasteboard contains one or more URLs.

var image → Image or null

Gets or sets the pasteboard content as a single image.

var images → Array of Image or null

Gets or sets the pasteboard content as a list of images.

var items → Array of Pasteboard.Item

The array of individual items on the pasteboard, each potentially with their own set of types.

var string → String or null

Gets or sets the pasteboard content as a single plain-text string.

var strings → Array of String or null

Gets or sets the pasteboard content as a list of plain-text strings.

var types → Array of TypeIdentifier read-only

The list of pasteboard types currently available on the pasteboard.

Pasteboard.Item

Constructors

new Pasteboard.Item() → Pasteboard.Item

Make a new empty pasteboard item with no contents.

Instance Functions

function dataForType(type: TypeIdentifier) → Data or null

The Data representation for the given type in this pasteboard item, or null if none is available.

function setDataForType(data: Data, type: TypeIdentifier)

Set the Data representation for the given type in this pasteboard item, replacing any previously set data.

function stringForType(type: TypeIdentifier) → String or null

The String representation for the given type in this pasteboard item, or null if none is available.

function setStringForType(string: String, type: TypeIdentifier)

Set the String representation for the given type in this pasteboard item, replacing any previously set data.

Instance Properties

var types → Array of TypeIdentifier read-only

The list of types available for this pasteboard item.

PlugIn

Class Functions

function find(identifier: String, minimumVersion: Version or null) → PlugIn or null

Class Properties

var all → Array of PlugIn read-only

Instance Functions

function library(identifier: String) → PlugIn.Library or null

Looks for a PlugIn.Library in the receiver and returns it if found.

function action(identifier: String) → PlugIn.Action or null

function handler(identifier: String) → PlugIn.Handler or null

function resourceNamed(name: String) → URL or null

function imageNamed(name: String) → Image or null

function localizedResourceNamed(filename: String) → FileWrapper or null

Instance Properties

var URL → URL or null read-only

Returns the original URL from whence this PlugIn came, if known.

var actions → Array of PlugIn.Action read-only

var author → String read-only

Returns the author for the PlugIn.

var description → String read-only

Returns the description provided for the PlugIn.

var displayName → String read-only

Returns the localized, human-readable name for the PlugIn.

var handlers → Array of PlugIn.Handler read-only

var identifier → String read-only

The unique identifier of the PlugIn.

var libraries → Array of PlugIn.Library read-only

var version → Version read-only

Returns the current Version for the PlugIn.

PlugIn.Action

Constructors

new PlugIn.Action(perform: Function) → PlugIn.Action

Returns a new PlugIn.Action. Only used within an action JavaScript file embedded within a PlugIn.

Instance Properties

var description → String read-only

var label → String read-only

Returns the default label to use for interface controls that invoke the action.

var longLabel → String read-only

Returns the label to use for interface controls that invoke the action, when a long amount of space is available.

var mediumLabel → String read-only

Returns the label to use for interface controls that invoke the action, when a medium amount of space is available.

var name → String read-only

Returns the name of the PlugIn.Action.

var paletteLabel → String read-only

Returns the label to use for interface controls that show a prototype of the action control, such as on a macOS toolbar configuration sheet.

var perform → Function read-only

var plugIn → PlugIn read-only

Returns the PlugIn that contains this object.

var shortLabel → String read-only

Returns the label to use for interface controls that invoke the action, when a short amount of space is available.

var validate → Function or null

A function to check whether the action is supported, given the current application state, as determined by the arguments passed (typically including the selection). This optional Function may be configured while the Action is being loaded, but after that the Action will be frozen.

PlugIn.Handler

Constructors

new PlugIn.Handler(invoke: Function) → PlugIn.Handler

Returns a new PlugIn.Handler. Only used within an handler JavaScript file embedded within a PlugIn.

Instance Properties

var invoke → Function read-only

The Function that will be executed for each handler registered for an event posted by an application object.

var name → String read-only

Returns the name of the PlugIn.Handler.

var plugIn → PlugIn read-only

Returns the PlugIn that contains this object.

var willAttach → Function or null

An optional Function that can be set on PlugIn.Handler as it is being loaded (but not after). This function is passed the application object that post events to trigger the handler. The return value should be a state object that is JSON archivable (or undefined if the handler has no state to maintain across invocations).

var willDetach → Function or null

An optional Function that can be set on PlugIn.Handler as it is being loaded (but not after). Called when a previously attached PlugIn.Handler is being detached from an application object. Any return value or thrown error are ignored.

PlugIn.Handler.Registration

Instance Functions

function remove()

Removes a previously added event observation.

PlugIn.Library

An object that represents a library from a plug-in.

Constructors

new PlugIn.Library(version: Version) → PlugIn.Library

Returns a new Library. Typically only used within a library JavaScript file embedded within a PlugIn.

Instance Properties

var name → String read-only

Returns the name of the PlugIn.Library.

var plugIn → PlugIn read-only

Returns the PlugIn that contains this object.

var version → Version read-only

Returns the Version of this library, as passed to the constructor.

Point

Class Properties

var unitX → Point read-only

Returns a Point with coordinates (1, 0).

var unitY → Point read-only

Returns a Point with coordinates (0, 1).

var zero → Point read-only

Returns the Point (0, 0), the origin.

Constructors

new Point(x: Number, y: Number) → Point

Returns a new Point with the specified coordinates.

Instance Functions

function add(point: Point) → Point

Returns a new Point that is the component-wise sum of the receiver and the argument Point.

function subtract(point: Point) → Point

Returns a new Point that is the component-wise difference of the receiver and the argument Point.

function scale(factor: Number) → Point

Returns a new Point where each component is scaled by the given factor.

function distanceTo(point: Point) → Number

Returns the distance between the receiver and the given Point.

function dot(point: Point) → Number

Returns the dot product between the receiver and the given Point.

Instance Properties

var length → Number read-only

Returns the distance between the receiver and the origin.

var negative → Point read-only

Returns the component-wise negative of the receiver.

var normalized → Point read-only

For a non-zero point, returns a point with a distance of one from the origin, but in the same direction as the original. For the zero point, this returns the receiver.

var x → Number

The horizontal axis coordinate of the Point.

var y → Number

The vertical axis coordinate of the Point.

Preferences

Constructors

new Preferences(identifier: String or null) → Preferences

Creates a new Preferences instance. The identifier specified may be null to create an instance for the currently loading plug-in. If it is null and a plug-in is not being loaded, an error will be thrown. Key/value pairs stored in the instance will be prefixed with the identifier and a “.”.

Instance Functions

function read(key: String) → Object or null

Returns the previously stored value for the given key, or null if no value is stored.

function readBoolean(key: String) → Boolean

Returns the previously stored value as a Boolean, or false if there is no stored value or it can’t be converted to a Boolean.

function readString(key: String) → String or null

Returns the previously stored value as a String, or null if there is no stored value or it is not a String.

function readNumber(key: String) → Number

Returns the previously stored value as a Number, or null if there is no stored value or it is not a Number.

function readDate(key: String) → Date or null

Returns the previously stored value as a Date, or null if there is no stored value or it is not a Date.

function readData(key: String) → Data or null

Returns the previously stored value as a Data, or null if there is no stored value or it is not a Data.

function write(key: String, value: Boolean, String, Number, Date, or Data or null)

Stores the specified key/value pair, or removes the pair if value is null.

function remove(key: String)

Removes and previously stored value for the given key.

Instance Properties

var identifier → String read-only

The scoping identifier the instance given when created, or the plug-in identifier if none was given.

Promise

The built-in JavaScript Promise constructor.

Rect

Constructors

new Rect(x: Number, y: Number, width: Number, height: Number) → Rect

Returns a new Rect with the specified coordinates and size.

Instance Functions

function insetBy(dx: Number, dy: Number) → Rect

function offsetBy(dx: Number, dy: Number) → Rect

function union(rect: Rect) → Rect

function intersect(rect: Rect) → Rect

function containsRect(rect: Rect) → Boolean

function containsPoint(point: Point) → Boolean

function intersects(rect: Rect) → Boolean

Instance Properties

var center → Point read-only

var height → Number

var integral → Rect read-only

var isEmpty → Boolean read-only

var isInfinite → Boolean read-only

var isNull → Boolean read-only

var maxX → Number read-only

var maxY → Number read-only

var midX → Number read-only

var midY → Number read-only

var minX → Number read-only

var minY → Number read-only

var origin → Point

var size → Size

var standardized → Rect read-only

var width → Number

var x → Number

var y → Number

Selection

Instance Properties

var allObjects → Array of Object read-only

Returns all the objects in the selection.

var columns → Array of Column read-only

Returns all the Column objects in the selection.

var document → OutlineDocument or null read-only

var editor → Editor or null read-only

The Editor that contains the selection, or null.

var items → Array of Item read-only

Returns the Items represented by the selected ItemTreeNodes, sorted by their order in the Outline.

var nodes → Array of ItemTreeNode read-only

The ItemTreeNode instances for the selected rows.

var outline → Outline or null read-only

The Outline that contains the selection, or null.

var styles → Array of Style read-only

Returns all the Style objects in the selection.

SharePanel

An interface that can display the system share interaction for the given items.

Constructors

new SharePanel(items: Array of URL, String, Image, or FileWrapper) → SharePanel

Create a new share panel with the given items.

Instance Functions

function addItem(shareItem: URL, String, Image, or FileWrapper)

Appends the item to the end of items.

function addItems(shareItems: Array of URL, String, Image, or FileWrapper)

Appends the contents of the given array to the end of items.

function removeItem(shareItem: URL, String, Image, or FileWrapper)

Removes the first occurrence of the item from items if it is present in items.

function removeItems(shareItems: Array of URL, String, Image, or FileWrapper)

Removes the first occurrence of each member of the given array from items if that member is present in items.

function clearItems()

Sets items to an empty array. Note: Calling show when items is empty results in an error, so be sure to add new items after calling this and before calling show.

function show()

Presents the share panel for its items. Calling this when items is empty will result in an error.

Instance Properties

var items → Array of URL, String, Image, or FileWrapper

The items that will be supplied to the system share interaction upon calling show.

Size

Constructors

new Size(width: Number, height: Number) → Size

Returns a new Size with the specified width and height.

Instance Properties

var height → Number

var width → Number

SortOrdering

Class Properties

var Ascending → SortOrdering read-only

Sort smaller numerical or lexigraphically preceding values first.

var Descending → SortOrdering read-only

Sort larger numerical or lexigraphically later values first.

var all → Array of SortOrdering read-only

Speech

Speech.Boundary

Class Properties

var Immediate → Speech.Boundary read-only

var Word → Speech.Boundary read-only

var all → Array of Speech.Boundary read-only

Speech.Synthesizer

Constructors

new Speech.Synthesizer() → Speech.Synthesizer

Instance Functions

function speakUtterance(utterance: Speech.Utterance)

Enqueues the utterance. If the utterance is already enqueued or speaking, throws an error.

function stopSpeaking(boundary: Speech.Boundary) → Boolean

function pauseSpeaking(boundary: Speech.Boundary) → Boolean

function continueSpeaking() → Boolean

Instance Properties

var paused → Boolean read-only

var speaking → Boolean read-only

Speech.Utterance

Class Properties

var defaultSpeechRate → Number read-only

var maximumSpeechRate → Number read-only

var minimumSpeechRate → Number read-only

Constructors

new Speech.Utterance(string: String) → Speech.Utterance

Instance Properties

var pitchMultiplier → Number

A value between 0.5 and 2.0, controlling the picth of the utterance.

var postUtteranceDelay → Number

var preUtteranceDelay → Number

var prefersAssistiveTechnologySettings → Boolean

If an assistive technology is on, like VoiceOver, the user’s selected voice, rate and other settings will be used for this speech utterance instead of the default values. If no assistive technologies are on, then the values of the properties on AVSpeechUtterance will be used. Note that querying the properties will not refect the user’s settings.

var rate → Number

A value between Speech.Utterance.minimumSpeechRate and Speech.Utterance.maximumSpeechRate controlling the rate of speech for the utterance.

var string → String or null read-only

var voice → Speech.Voice or null

The voice to use for this utterance, or null in which case the default voice will be used.

var volume → Number

A value between 0.0 and 1.0 controller the volume of the utterance.

Speech.Voice

Class Functions

function withLanguage(code: String or null) → Speech.Voice or null

Returns a voice for the given BCP–47 language code (such as en-US or fr-CA), or the default voice if passed null. Returns null for an invalid langauge code.

function withIdentifier(identifier: String) → Speech.Voice or null

Returns the voice with the given identifier, or null if not found.

Class Properties

var allVoices → Array of Speech.Voice read-only

var currentLanguageCode → String read-only

Instance Properties

var gender → Speech.Voice.Gender read-only

var identifier → String read-only

var language → String read-only

var name → String read-only

Speech.Voice.Gender

Class Properties

var Female → Speech.Voice.Gender read-only

var Male → Speech.Voice.Gender read-only

var Unspecified → Speech.Voice.Gender read-only

var all → Array of Speech.Voice.Gender read-only

State

Class Properties

var Checked → State read-only

The checkbox value is checked.

var Mixed → State read-only

The checkbox value has a mixed state, due to child items having a combination of Checked and Unchecked states.

var Unchecked → State read-only

The checkbox value is not checked.

var all → Array of State read-only

StringEncoding

Class Properties

var ASCII → StringEncoding read-only

var ISO2022JP → StringEncoding read-only

var ISOLatin1 → StringEncoding read-only

var ISOLatin2 → StringEncoding read-only

var JapaneseEUC → StringEncoding read-only

var MacOSRoman → StringEncoding read-only

var NextStep → StringEncoding read-only

var NonLossyASCII → StringEncoding read-only

var ShiftJIS → StringEncoding read-only

var Symbol → StringEncoding read-only

var UTF16 → StringEncoding read-only

var UTF16BigEndian → StringEncoding read-only

var UTF16LittleEndian → StringEncoding read-only

var UTF32 → StringEncoding read-only

var UTF32BigEndian → StringEncoding read-only

var UTF32LittleEndian → StringEncoding read-only

var UTF8 → StringEncoding read-only

var Unicode → StringEncoding read-only

var WindowsCP1250 → StringEncoding read-only

var WindowsCP1251 → StringEncoding read-only

var WindowsCP1252 → StringEncoding read-only

var WindowsCP1253 → StringEncoding read-only

var WindowsCP1254 → StringEncoding read-only

var all → Array of StringEncoding read-only

Style

Instance Functions

function set(attribute: Style.Attribute, value: Object or null) → Boolean

Sets (or clears) the value for the given style attribute. Styles that cascade from this one will inherit this value, if they don’t define their own value or have a closer ancestor style that does. Returns true if a change was actually made, false otherwise. Throws an error if the key does not map to a known attribute, or if the value is of the wrong type for the specified attribute.

function get(attribute: Style.Attribute) → Object or null

Looks up the value for the specified style attribute locally, in the cascading and inherited styles, and finally falling back to the default value for the style attribute.

function localValueForAttribute(attribute: Style.Attribute) → Object or null

Looks up the value for the specified style attribute locally, returning null if it is not set.

function addNamedStyle(namedStyle: NamedStyle)

Adds the specified NamedStyle to the set of named styles to include in this Style. If the style is already present, or if this would create a loop (adding two NamedStyles to each other’s list of named styles), an error will be thrown.

function removeNamedStyle(namedStyle: NamedStyle)

Removes the specified NamedStyle from the set of named styles to include in this Style. If the style is not present, an error will be thrown.

function influencedBy(otherStyle: Style) → Boolean

Returns true if the receiver is influenced, directly or indirectly from the passed Style.

function setStyle(style: Style)

Updates all the attributes and inherited styles on the receiver to be the same as the argument Style.

function clear()

Removes all the locally applied style attribute values for this Style.

Instance Properties

var fontFillColor → Color

The color used to fill text. Setting the color to null will remove the setting for this style.

var link → URL or null read-only

Returns the URL link for a style, or null if there is no link applied. Note that get(Style.Attribute.Link) on the same style will return the default URL with an empty toString() value when there is no URL applied. If the style represents a file attachment and there is no specific link attribute set, the URL for the file attachment will be returned. If the style represents an file attachment that is embedded in the document, null will be returned.

var locallyDefinedAttributes → Array of Style.Attribute read-only

Returns an array of the Style.Attributes defined on this Style.

var namedStyles → Array of NamedStyle read-only

Returns the NamedStyles that are directly associated with this Style. If a style attribute lookup doesn’t find a value in the local style, then the named styles will be searched.

NamedStyle : Style

Instance Functions

function remove()

Removes the NamedStyle from the document. Any references to it are disconnected as well.

Instance Properties

var after → NamedStylePosition read-only

Returns a NamedStylePosition that indicates the slot after this item.

var before → NamedStylePosition read-only

Returns a NamedStylePosition that indicates the slot before this item.

var identifier → String read-only

A unique identifier for the style, which is suitable for long-lived references.

var name → String

The name of the style that is presented in the interface.

Style.Attribute

Class Properties

var BackgroundColor → Style.Attribute read-only

var BaselineOffset → Style.Attribute read-only

var BaselineSuperscript → Style.Attribute read-only

var Expansion → Style.Attribute read-only

var FontCondensed → Style.Attribute read-only

var FontFamily → Style.Attribute read-only

var FontFillColor → Style.Attribute read-only

var FontFixedPitch → Style.Attribute read-only

var FontItalic → Style.Attribute read-only

var FontName → Style.Attribute read-only

var FontNarrow → Style.Attribute read-only

var FontSize → Style.Attribute read-only

var FontStrokeColor → Style.Attribute read-only

var FontStrokeWidth → Style.Attribute read-only

var FontWeight → Style.Attribute read-only

var KerningAdjustment → Style.Attribute read-only

var LigatureSelection → Style.Attribute read-only

var Link → Style.Attribute read-only

var Obliqueness → Style.Attribute read-only

var ParagraphAlignment → Style.Attribute read-only

var ParagraphBaseWritingDirection → Style.Attribute read-only

var ParagraphDefaultTabInterval → Style.Attribute read-only

var ParagraphFirstLineHeadIndent → Style.Attribute read-only

var ParagraphHeadIndent → Style.Attribute read-only

var ParagraphLineHeightMultiple → Style.Attribute read-only

var ParagraphLineSpacing → Style.Attribute read-only

var ParagraphMaximumLineHeight → Style.Attribute read-only

var ParagraphMinimumLineHeight → Style.Attribute read-only

var ParagraphSpacing → Style.Attribute read-only

var ParagraphSpacingBefore → Style.Attribute read-only

var ParagraphTabStops → Style.Attribute read-only

var ParagraphTailIndent → Style.Attribute read-only

var ShadowBlurRadius → Style.Attribute read-only

var ShadowColor → Style.Attribute read-only

var ShadowOffset → Style.Attribute read-only

var StrikethroughAffinity → Style.Attribute read-only

var StrikethroughColor → Style.Attribute read-only

var StrikethroughPattern → Style.Attribute read-only

var StrikethroughStyle → Style.Attribute read-only

var UnderlineAffinity → Style.Attribute read-only

var UnderlineColor → Style.Attribute read-only

var UnderlinePattern → Style.Attribute read-only

var UnderlineStyle → Style.Attribute read-only

Instance Properties

var defaultValue → Object read-only

Returns the default value that will be used when a style has no local value for this attribute, nor do any of its associated styles.

var key → String read-only

Returns the string used to identify this attribute when calling get or set on a Style instance.

Text

Class Functions

function makeFileAttachment(fileWrapper: FileWrapper, style: Style) → Text

Returns a new Text instance that represents a file attachment. The attachment has a single character string content with a special value.

Constructors

new Text(string: String, style: Style) → Text

Returns a new Text instance with the given string contents and Style applied to the entire range of text.

Instance Functions

function textInRange(range: Text.Range) → Text

Returns a copy of the text in the specified range.

function styleForRange(range: Text.Range) → Style

Returns a Style instance for the given range of the Text.

function ranges(component: TextComponent, useEnclosingRange: Boolean or null) → Array of Text.Range

Returns an array of TextRanges for the specified component. If useEnclosingRange is true, than any extra characters that separate follow a component will be included in its range. Any extra characters before the first found component will be included in the first range.

function replace(range: Text.Range, with: Text)

Replaces the sub-range of the receiving Text with a copy of the passed in Text (which remains unchanged).

function append(text: Text)

Appends the given Text to the receiver.

function insert(position: Text.Position, text: Text)

Inserts a copy of the given Text at the specified position in the receiver.

function remove(range: Text.Range)

Removes the indicated sub-range of the receiving Text.

function find(string: String, options: Array of Text.FindOption or null, range: Text.Range or null) → Text.Range or null

Finds an occurrence of string within the Text and returns the enclosing Text.Range if there is a match. If range is passed, only that portion of the Text is searched. The supplied options, if any, change how the search is performed based on their definition.

Instance Properties

var attachments → Array of Text read-only

Returns an array of copies of the blocks of Text in the receiver that represent Attachments. Note that editing these instances will not change the original.

var attributeRuns → Array of Text read-only

Returns an array of copies of the contiguous blocks of Text in the receiver that have the same style. Note that editing these instances will not change the original.

var characters → Array of Text read-only

Returns an array of copies of the characters in the Text. Note that editing these instances will not change the original.

var end → Text.Position read-only

Returns a Text.Position indicating the end of the Text.

var fileWrapper → FileWrapper or null read-only

Returns the attached file wrapper for the Text (or rather, the first character of the text), if any.

var paragraphs → Array of Text read-only

Returns an array of copies of the paragraphs in the Text. Note that editing these instances will not change the original. Paragraphs, if ended by a newline, will contain the newline character.

var range → Text.Range read-only

Returns a Text.Range that spans the entire Text.

var sentences → Array of Text read-only

Returns an array of copies of the sentences in the Text. Note that editing these instances will not change the original.

var start → Text.Position read-only

Returns a Text.Position indicating the beginning of the Text.

var string → String

Returns a plain String version of the characters in the Text. Note that since JavaScript represents Strings as Unicode code points, the length of the returned string may be different from the number of characters in the Text object.

Assigning to this property replaces the string content of the Text with the given string. The style applied to the updated characters is either the base style of the Text if it is currently empty, or the style of the first replaced character otherwise.

var style → Style read-only

Returns a Style instance for this Text object.

var words → Array of Text read-only

Returns an array of copies of the words in the Text. Note that editing these instances will not change the original.

Text.FindOption

Class Properties

var Anchored → Text.FindOption read-only

Matches must be anchored to the beginning (or end if Backwards is include) of the string or search range.

var Backwards → Text.FindOption read-only

Search starting from the end of the string or range.

var CaseInsensitive → Text.FindOption read-only

Compare upper and lower case characters as equal.

var DiacriticInsensitive → Text.FindOption read-only

Ignore diacritics. For example, “ö” is considered the same as “o”.

var ForcedOrdering → Text.FindOption read-only

Force an ordering between strings that aren’t strictly equal.

var Literal → Text.FindOption read-only

Perform exact character-by-character matching.

var Numeric → Text.FindOption read-only

Order numbers by numeric value, not lexigraphically. Only applies to ordered comparisons, not find operations.

var RegularExpression → Text.FindOption read-only

For find operations, the string is treated as an ICU-compatible regular expression. If set, no other options can be used except for CaseInsensitive and Anchored.

var WidthInsensitive → Text.FindOption read-only

Ignore width differences. For example, “a” is considered the same as ‘FULLWIDTH LATIN SMALL LETTER A’ (U+FF41).

var all → Array of Text.FindOption read-only

Text.Position

Text.Range

Constructors

new Text.Range(start: Text.Position, end: Text.Position) → Text.Range

Instance Properties

var end → Text.Position read-only

Returns the Text.Position for the end of the Text.Range

var isEmpty → Boolean read-only

Returns true if the Text.Range contains no characters.

var start → Text.Position read-only

Returns the Text.Position for the beginning of the Text.Range

TextAlignment

Class Properties

var Center → TextAlignment read-only

Visually center aligned.

var Justified → TextAlignment read-only

Fully-justified.

var Left → TextAlignment read-only

Visually left aligned.

var Natural → TextAlignment read-only

Use the default alignment based on the characters in the text.

var Right → TextAlignment read-only

Visually right aligned.

var all → Array of TextAlignment read-only

TextComponent

Class Properties

var Attachments → TextComponent read-only

The ranges of Text which represent Attachments.

var AttributeRuns → TextComponent read-only

The ranges of Text which have the same attributes.

var Characters → TextComponent read-only

The individual characters of the Text. Note that some characters (like emoji) consist of multiple Unicode code points.

var Paragraphs → TextComponent read-only

The paragraphs of Text. Unlike other options, the line breaking characters that end the paragraph are included.

var Sentences → TextComponent read-only

The sentences of the Text.

var Words → TextComponent read-only

The words in the Text. Whitespace or other word break characters are not included.

var all → Array of TextComponent read-only

TimeZone

Class Properties

var abbreviations → Array of String read-only

The list of known time zone abbreviations.

Constructors

new TimeZone(abbreviation: String) → TimeZone or null

Make a new TimeZone with the given abbreviation. Note that the returned TimeZone may have a different abbreviation than the passed argument. For example, if one of “PST” or “PDT” is requested that doens’t match the current use of daylight savings time, the one that does match will be returned.

Instance Properties

var abbreviation → String or null read-only

The abbreviation for the TimeZone.

var daylightSavingTime → Boolean read-only

Returns true if the TimeZone is currently using daylight savings time.

var secondsFromGMT → Number read-only

The current difference in seconds between this TimeZone and GMT.

Timer

Class Functions

function once(interval: Number, action: Function(‍timer: Timer‍)) → Timer

Makes a new Timer that will fire once, after the specified interval (in seconds from the current time). When the Timer fires, the passed in Function is called, passing the Timer as its argument.

function repeating(interval: Number, action: Function(‍timer: Timer‍)) → Timer

Makes a new Timer that will fire repeatedly with the specified interval (in seconds, with the first invocation happening that interval after the current time). When the Timer fires, the passed in Function is called, passing the Timer as its argument.

Instance Functions

function cancel()

Instance Properties

var interval → Number read-only

ToolbarItem

Instance Properties

var image → Image or null

var label → String

var toolTip → String or null

Tree

Instance Functions

function nodeForObject(object: Object) → TreeNode or null

Returns the TreeNode that represents the object in this Tree, or null if it cannot be found (possibly filtered out).

function nodesForObjects(object: Array of Object) → Array of TreeNode

Returns an array of TreeNodes for the objects that are currently in the Tree, according to the same filters as nodeForObject(). The size of the resulting node array may be smaller (even empty) than the passed in objects array.

function reveal(nodes: Array of TreeNode)

Ensures the ancestor nodes of all the specified nodes are expanded.

function select(nodes: Array of TreeNode, extending: Boolean or null)

Selects the specified TreeNodes that are visible (nodes with collapsed ancestors cannot be selected). If extending is true, the existing selection is not cleared.

function copyNodes(nodes: Array of TreeNode, to: Pasteboard)

Writes a serialized version of the nodes to the specified pasteboard.

function paste(from: Pasteboard, parentNode: TreeNode or null, childIndex: Number or null)

Attempts to read a serialized version of nodes from the pasteboard and create new items at the specified location in the receiver. If a parent node is not specified, then the root node of the receiver is assumed. If a childIndex is not specified, any new children are placed at the end of the parent’s existing children.

Instance Properties

var rootNode → TreeNode read-only

Returns the rootNode of the Editor.

var selectedNodes → Array of TreeNode read-only

Returns the list of selected TreeNodes, in the order they appear in the tree.

Editor : Tree

Instance Functions

function visibilityOfColumn(column: Column) → Boolean

Returns true if the specified Column is visible.

function setVisibilityOfColumn(column: Column, visible: Boolean)

Sets the visibility of the specified Column within the Editor.

function widthForColumn(column: Column) → Number

Returns the width in points used to display the Column, assuming a zoom factor of 1.0.

function setWidthForColumn(column: Column, width: Number)

Sets the width in points used to display the Column, assuming a zoom factor of 1.0.

function sortOrderingForColumn(column: Column) → SortOrdering or null

Returns the current sort ordering in this editor for the specified Column, or null if no ordering is set.

function setSortOrderingForColumn(column: Column, order: SortOrdering or null)

Changes the sort ordering for the specified Column in this editor.

function withoutSorting(function: Function) → Object or null

Temporarily disables any automatic sorting while running the passed in Function (which is invoked with zero arguments). The result of the function is returned.

function summaryForColumn(column: Column) → Column.Summary or null

Returns the current Summary used to calculate cells value for parent items in the specified Column, or null if the values are directly editable.

function setSummaryForColumn(column: Column, summary: Column.Summary or null)

Sets or clears the Summary used to calculate cells value for parent items.

function beforeColumn(column: Column or null) → EditorColumnPosition

Returns an EditorColumnPosition that indicates the slot before the specified column, or before all columns if null is given.

function afterColumn(column: Column or null) → EditorColumnPosition

Returns an EditorColumnPosition that indicates the slot after the specified column, or after all columns if null is given.

function nodeForItem(item: Item) → TreeNode or null

Deprecated: Please use nodeForObject instead.

Returns the TreeNode that represents the item in this Editor, or null if it cannot be found (possibly filtered out, or not contained in the focusedItems).

function nodesForItems(items: Array of Item) → Array of TreeNode

Deprecated: Please use nodeForObjects instead.

Returns an array of TreeNodes for the Items that are currently in the Editor’s filtered and focused view. The size of the resulting node array may be smaller (even empty) than the passed in items array.

function scrollToNode(node: TreeNode)

Attempts to scroll the view so that the specified TreeNode is visible. If the node is not revealed due to a collapsed ancestor, this may not be possible and no scrolling will be performed.

function indentNodes(nodes: Array of TreeNode)

Indents the specified nodes one level, or throws an error if that isn’t possible.

function outdentNodes(nodes: Array of TreeNode)

Outdents the specified nodes one level, or throws an error if that isn’t possible.

Instance Properties

var autosizeTopicColumn → Boolean

Whether the topic column automatically changes width along with its window.

var bottomBarVisible → Boolean

Whether the bottom bar containing word and character counts is currently visible in the window. On iOS, this is always false.

var focusedItems → Array of Item

The set of items to show in the content area. If empty, the entire outline is shown.

var foldingEnabled → Boolean

When set, cells with text that would layout over multiple lines only show their first line, followed by an ellipsis. Editing a cell that is folded, will temporarily expand it.

var inspectorVisible → Boolean

Whether the inspector is currently visible in the window. On iOS, showing this pane may implicitly hide other panes and may be only transiently visible, depending on the available space.

var noteDisplay → NoteDisplay

Now the notes for each row are displayed, either together with their row when Inline is selected, or in a separate pane with Pane.

var selection → Selection read-only

Returns the current Selection in the editor.

var sidebarVisible → Boolean

Whether the sidebar is currently visible in the window. On iOS, showing this pane may implicitly hide other panes and may be only transiently visible, depending on the available space.

var toolbarVisible → Boolean

Whether the toolbar is currently visible in the window. On iOS, this is always true.

TreeNode

Instance Functions

function childAtIndex(childIndex: Number) → TreeNode

Returns the child node at the given index.

function expand(completely: Boolean or null)

Attempts to expand the TreeNode. If completely is passed, all the child nodes will be expanded as they allow.

function collapse(completely: Boolean or null)

Attempts to collapse the TreeNode. If completely is passed, all the child nodes will be collapse as they allow.

function expandNote(completely: Boolean or null)

Attempts to expand the inline note of the TreeNode. If completely is passed, all the child node notes will be expanded.

function collapseNote(completely: Boolean or null)

Attempts to collapse the inline note of the TreeNode. If completely is passed, all the child node notes will be collapsed.

function reveal()

Expands all the

function apply(function: Function(‍node: TreeNode‍) → ApplyResult or null) → ApplyResult or null

Calls the supplied function for each TreeNode in the receiver (including the receiver), passing that node as the single argument. The supplied function can optionally return a ApplyResult to skip enumeration of some elements.

Instance Properties

var canCollapse → Boolean read-only

Returns true if this TreeNode can be collapsed.

var canExpand → Boolean read-only

Returns true if this TreeNode can be expanded.

var childCount → Number read-only

Returns the number of children directly under this node.

var children → Array of TreeNode read-only

Returns the array of children that are visible under this node, according to any filtering that is being done, and in the order specified by any sorting rules that have been established.

var index → Number read-only

Returns the index of this TreeNode among its siblings, or zero for the rootNode.

var isExpanded → Boolean read-only

Returns true if this TreeNode is currently expanded.

var isNoteExpanded → Boolean read-only

Returns true if the note of this TreeNode is currently expanded.

var isRevealed → Boolean read-only

Returns true if the TreeNode is the rootNode or all of its ancestor nodes are expanded.

var isRootNode → Boolean read-only

Returns true if this node is the rootNode of its tree.

var isSelectable → Boolean read-only

Returns true if this TreeNode can be selected. The rootNode cannot be selected, nor can nodes that aren’t revealed.

var isSelected → Boolean

Set to true if this TreeNode is in the list of selected nodes for its tree. Attempting to set this to true will do nothing if the node is not revealed (or is the root node).

var level → Number read-only

Returns the nesting level of the TreeNode, relative to the root of the tree. The rootNode of an Outline has level zero, its children have level one, and so on. Note that if only a portion of the model is being shown, this level may not match the level of the underlying object.

var object → Object read-only

The model object which this node wraps.

var parent → TreeNode or null read-only

Returns the TreeNode that contains this node, or null if this is the rootNode.

var rootNode → TreeNode read-only

Returns the root TreeNode for the tree that this node belongs to.

ItemTreeNode : TreeNode

Instance Functions

function setValueForColumn(value: Object or null, column: Column)

function valueForColumn(column: Column) → Object or null

Instance Properties

var state → State or null

The computed status value for this node (which maps to the Outline’s statusColumn). Setting the state on a parent node will propagate the state down to the children, skipping any children that have their state disabled by having a null applied locally.

TypeIdentifier

Class Functions

function fromPathExtension(pathExtension: String, isDirectory: Boolean) → TypeIdentifier

Return a TypeIdentifier that matches items that have the given path extension and are (or are not) directories.

Class Properties

var URL → TypeIdentifier read-only

The URL type.

var binaryPropertyList → TypeIdentifier read-only

The binary property list type.

var csv → TypeIdentifier read-only

The comma-separated text type.

var editableTypes → Array of TypeIdentifier read-only

The list of TypeIdentifiers that can be read and written natively by documents in this application.

var gif → TypeIdentifier read-only

The GIF image type.

var image → TypeIdentifier read-only

A generic type that all image types conform to.

var jpeg → TypeIdentifier read-only

The JPEG image type.

var json → TypeIdentifier read-only

The JSON type.

var pdf → TypeIdentifier read-only

The PDF type.

var plainText → TypeIdentifier read-only

The plain text type (public.plain-text). Primarily used for conformance tests (i.e. is this other type a type of text). See also .utf8PlainText.

var png → TypeIdentifier read-only

The PNG image type.

var propertyList → TypeIdentifier read-only

The generic property list type.

var readableTypes → Array of TypeIdentifier read-only

The list of TypeIdentifiers that can be read by documents in this this application.

var rtf → TypeIdentifier read-only

The RTF type.

var rtfd → TypeIdentifier read-only

The RTFD type.

var tiff → TypeIdentifier read-only

The TIFF image type.

var utf8PlainText → TypeIdentifier read-only

The UTF–8 plain text type (public.utf8-plain-text). This is the type used by Pasteboard.string.

var writableTypes → Array of TypeIdentifier read-only

The list of TypeIdentifiers that can be written by documents in this application (though some documents may be exportable only in a subset of these types).

var xmlPropertyList → TypeIdentifier read-only

The XML property list type.

Constructors

new TypeIdentifier(identifier: String) → TypeIdentifier

Returns a new TypeIdentifier with the given identifier.

Instance Functions

function conformsTo(other: TypeIdentifier) → Boolean

Returns true if the instance is the same as the given argument or a more specific type. For example, TypeIdentifier.png.conformsTo(TypeIdentifier.image) will be true, but TypeIdentifier.png.conformsTo(TypeIdentifier.plainText) will be false.

Instance Properties

var displayName → String read-only

Returns a human-readable description of the type.

var identifier → String read-only

Returns a unique string for a type identifier, suitable for archiving or encoding in scripts.

var pathExtensions → Array of String read-only

The list of filesystem path extensions used by this type.

URL

Class Functions

function choose(types: Array of String) → URL or null

Deprecated: Please use FilePicker instead.

Allows the user to choose a file URL if possible and returns a new instance, or null otherwise.

function chooseFolder() → URL or null

Deprecated: Please use FilePicker instead.

Allows the user to choose a folder URL if possible and returns a new instance, or null otherwise.

function fromString(string: String, relativeToURL: URL or null) → URL or null

Parses the string as a URL if possible and returns a new instance, or null if the string is not a valid URL. If baseURL is not null, the result is a relative URL.

function fromPath(path: String, isDirectory: Boolean, relativeToURL: URL or null) → URL

Returns a new file URL with the given path and assumption of whether it is a directory.

function tellScript(app: String, js: String, arg: Object or null) → URL or null

Creates a URL to invoke the given JS on the given app (url scheme) appropriate for use with the call function.

function tellFunction(app: String, jsFunction: Function, arg: Object or null) → URL or null

Creates a URL to invoke the given JS function on the given app (url scheme) appropriate for use with the call function.

function omniLink(path: String, folderName: String) → URL

Constructs an Omni Link for a given path inside a Connected Folder.

function resolveFileURLForOmniLink(omniLink: URL, additionalPromptMessage: String or null, additionalQueryItems: Array of URL.QueryItem or null) → Promise of URL

Resolves an Omni Link into a file URL.

function omniLinkForFileURL(fileURL: URL, additionalQueryItems: Array of URL.QueryItem or null, additionalPromptMessage: String or null) → Promise of URL

Generates an Omni Link from a file URL, with optional parameters for additional query items and prompt message text.

Class Properties

var currentAppScheme → String read-only

Returns the URL scheme for the current app.

var documentsDirectory → URL read-only

Returns the application’s Documents directory. This is in the application’s sandbox, and on the Mac is not the user’s Documents directory. This is accessible by the application without using access().

Instance Functions

function fetch(success: Function(‍contents: Data‍), failure: Function(‍error: Error‍) or null)

Get the contents at the destination of this URL.

function call(success: Function, failure: Function or null)

Invoke an x-callback-url API end-point, with the callback functions being invoked when a reply is received. When a reply is received, the parameters of that URL are decoded as JSON, or left as String values if not valid JSON, and stored as properties of a result object. For a successful reply, if the result object has one property, its value is passed as the first argument to the success function. If there are zero or more than one parameters, the full object is passed as the first argument. In both cases, the success function is passed a second argument that is the full object of parameters. The failure callback is always passed the object will all the result parameters, typically errorCode and errorMessage.

function open()

Ask the system to open this URL.

function revealFile() → Promise of Boolean

Ask the system to reveal a file URL.

function find(types: Array of TypeIdentifier, recurse: Boolean or null) → Promise of Array of URL

Scan a directory URL for files of the given types. If recurse is specified and is false, only the immediate contents of the directory will be considered. If recurse is not specified or is true, the full directory tree will be scanned.

function toString() → String

function appendingPathComponent(component: String) → URL

Return a new URL with the given string added at the end of the path.

function appendingPathExtension(pathExtension: String) → URL

Returns a new URL with the last path component having the given path extension added, including a separating “.”

function deletingPathExtension() → URL

Returns a new URL with the path extension (if any) of the last path component removed.

function deletingLastPathComponent() → URL

Returns a new URL with the last path component removed.

Instance Properties

var absoluteString → String read-only

Returns the absolute string for the URL.

var absoluteURL → URL read-only

Returns the absolute URL.

var baseURL → URL or null read-only

Returns the base URL if this URL is relative, or null if it is absolute.

var fragment → String or null read-only

Returns the fragment component of the URL, or null.

var hasDirectoryPath → Boolean read-only

Returns true if the URL’s path represents a directory.

var host → String or null read-only

Returns the host component of the URL or null.

var isFileURL → Boolean read-only

Returns true if the scheme is file:.

var lastPathComponent → String read-only

Returns the last component of the URL’s path or an empty string.

var password → String or null read-only

Returns the password component of the URL or null.

var path → String or null read-only

Returns the path component of the URL or null.

var pathComponents → Array of String read-only

Returns the path of the URL as an array of components.

var pathExtension → String read-only

Returns the path extension of the last path component of the URL or the empty string.

var port → Number or null read-only

Returns the port component of the URL or null.

var query → String or null read-only

Returns the query component of the URL or null.

var relativePath → String or null read-only

Returns the relative path of the URL, or the absolute path if this URL is not relative

var relativeString → String read-only

Returns the relative portion of the URL if it is relative, otherwise this returns the absolute string.

var scheme → String or null read-only

Returns the scheme of the URL.

var string → String read-only

String absoluteString representation of this URL.

var user → String or null read-only

Returns the user component of the URL or null.

URL.Access

A URL.Access holds the temporary access given by the URL.Bookmark.access() function. These should not be stored longer than needed.

Instance Properties

var url → URL read-only

The URL being accessed.

URL.Bookmark

A URL.Bookmark records the permission to access a given URL and will restore that permission, as well as a possibly renamed file, at a later point.

Class Functions

function fromURL(url: URL) → URL.Bookmark

Creates a URL.Bookmark from an existing URL, which should have been returned by FilePicker. This can then be stored in a Credentials object to persistently record the permission to access this URL.

Instance Functions

function access() → Promise of URL.Access

Attempts to resolve the instance into a URL and grant access to it through the returned Promise. Access to the URL will only last as long as the URL.Access object exists (which should not be stored longer than necessary).

URL.Components

URL.Components allows for correct generation and interpreation of URL instances, dealing with the specific different quoting rules for each specific part of the URL.

Class Functions

function fromString(string: String) → URL.Components or null

Parses the string into URL.Components. If the string is not a valid URL, null is returned.

function fromURL(url: URL, resolvingAgainstBaseURL: Boolean) → URL.Components or null

Parses the string represenation of the URL. If the URL’s string is malformed, null is returned. If resolve is true and the given url is relative, its base URL’s components are considered.

Constructors

new URL.Components() → URL.Components

Returns a new URL.Components.

Instance Functions

function urlRelativeTo(base: URL or null) → URL or null

Returns a URL relative to the base URL and the components or null.

Instance Properties

var fragment → String or null

var host → String or null

var password → String or null

var path → String

var port → Number or null

var query → String or null

var queryItems → Array of URL.QueryItem or null

The query of the URL.Components as individual components.

var scheme → String or null

var url → URL or null read-only

Returns a URL for the components or null.

var user → String or null

URL.FetchRequest

URL.FetchRequest represents a request for a URL resource, providing additional controls for the request (such as the HTTP method, headers, and cache controls) and uses a Promise-based API for actually performing the request and receiving a detailed response (which includes the HTTP status code and headers along with the body of the result—see URL.FetchResponse for more detail).

Class Functions

function fromString(string: String) → URL.FetchRequest or null

Parses the string as a URL if possible and returns a new instance, or null otherwise.

Constructors

new URL.FetchRequest() → URL.FetchRequest

Creates a new instance.

Instance Functions

function fetch() → Promise of URL.FetchResponse

Perform the request, returning a Promise. On success, the promise will resolve to a URL.FetchResponse.

Instance Properties

var allowsConstrainedNetworkAccess → Boolean

Whether connections may use the network when the user has specified Low Data Mode.

var allowsExpensiveNetworkAccess → Boolean

Whether connections may use a network interface that the system considers expensive.

var bodyData → Data or null

The body of the request, typically used in an HTTP POST or PUT request. This API is suitable for uploading binary data, or for text which needs to be encoded in a form other than UTF–8. If UTF–8 text is suitable, bodyString is likely to be a better choice.

var bodyString → String or null

The body of the request, typically used in an HTTP POST or PUT request. The provided string will be transmitted using the UTF–8 encoding.

var cache → String or null

The cache policy for the request: default, no-store, reload, no-cache, force-cache, or only-if-cached.

var headers → Object

Custom HTTP headers to be sent with this request.

var httpShouldHandleCookies → Boolean

Whether to automatically handle cookies.

var httpShouldUsePipelining → Boolean

Whether to transmit data before receiving a response from an earlier request.

var method → String or null

The HTTP request method of the request: GET, POST, PUT, DELETE, etc.

var url → URL or null

The URL for this fetch request. Much of the additional functionality provided by the fetch request API will only work with http and https URLs. (For example, the method and cache and headers don’t have any effect in the context of a file or omnifocus URL.)

URL.FetchResponse

URL.FetchResponse represents the response from fetching a URL resource, providing additional information about the response such as the HTTP status code and headers along with the actual data for that response. This is a read-only object returned by performing a URL.FetchRequest; see that class for more details on actually performing the request.

Instance Properties

var bodyData → Data or null read-only

Returns the raw HTTP body data from this response.

var bodyString → String or null read-only

This is a convenience wrapper which interprets the bodyData of this response as UTF–8 text. (Note: the current implementation assumes the text is encoded using UTF–8, but ideally it would honor the text encoding as reported by textEncodingName.)

var headers → Object read-only

Returns the HTTP header fields for this response.

var mimeType → String or null read-only

Returns the HTTP MIME type for this response (e.g. text/plain, application/json, etc.).

var statusCode → Number read-only

Returns the HTTP status code for this response (e.g. 200, 404, etc.).

var textEncodingName → String or null read-only

Returns the reported text encoding for this response. This name will be the actual string reported by the origin source, or null if no encoding was specified.

var url → URL or null read-only

Returns the URL for this response.

URL.QueryItem

Constructors

new URL.QueryItem(name: String, value: String or null) → URL.QueryItem

Returns a new URL.QueryItem with the given name and value.

Instance Properties

var name → String read-only

var value → String or null read-only

UnderlineAffinity

Class Properties

var ByWord → UnderlineAffinity read-only

Underline only the words, but not the space between them.

var None → UnderlineAffinity read-only

Underline the entire range.

var all → Array of UnderlineAffinity read-only

UnderlinePattern

Class Properties

var Dash → UnderlinePattern read-only

Dashed line.

var DashDot → UnderlinePattern read-only

Alternating dashes and dots.

var DashDotDot → UnderlinePattern read-only

Alternating dashes and pairs of dots.

var Dot → UnderlinePattern read-only

Dotted line.

var Solid → UnderlinePattern read-only

A continuous line.

var all → Array of UnderlinePattern read-only

UnderlineStyle

Class Properties

var Double → UnderlineStyle read-only

Two lines.

var None → UnderlineStyle read-only

No underline.

var Single → UnderlineStyle read-only

A single line.

var Thick → UnderlineStyle read-only

A single thick line.

var all → Array of UnderlineStyle read-only

Version

Constructors

new Version(versionString: String) → Version

Parses a string representation of a Version and returns an instance, or throws an error if the string isn’t a valid version.

Instance Functions

function equals(version: Version) → Boolean

Returns true if the receiving Version is equal to the argument Version.

function atLeast(version: Version) → Boolean

Returns true if the receiving Version is at the same as or newer than the argument Version.

function isAfter(version: Version) → Boolean

Returns true if the receiving Version is strictly after the argument Version.

function isBefore(version: Version) → Boolean

Returns true if the receiving Version is strictly before the argument Version.

Instance Properties

var versionString → String read-only

Returns as an opaque string representation of the Version, suitable for display or logging. This should never be used in comparisons of any sort.

WritingDirection

Class Properties

var LeftToRight → WritingDirection read-only

Text is laid out from left to right.

var Natural → WritingDirection read-only

The text direction follows the Unicode bi-directional algorithm.

var RightToLeft → WritingDirection read-only

Text is laid out from right to left.

var all → Array of WritingDirection read-only

XML

XML.Document

Class Functions

function fromData(data: Data, whitespaceBehavior: XML.WhitespaceBehavior or null) → XML.Document

Parse the given data as an XML document.

Constructors

new XML.Document(rootElement: String or XML.Element, configuration: XML.Document.Configuration or null) → XML.Document

Returns a new XML.Document with the given root element and configuration.

Instance Functions

function xmlData() → Data

Encodes the document as XML.

function addElement(name: String, function: Function(‍‍) or null)

Appends a new element with the given name. If a function is passed, it is pushed it on the current element stack, the supplied function is called, and then the element is popped off the stack.

function appendString(string: String)

Appends the given string as a child of topElement.

function setAttribute(attribute: String, value: String or null)

Sets the specified attribute on topElement.

Instance Properties

var dtdPublicID → String or null read-only

var dtdSystemID → URL or null read-only

var rootElement → XML.Element read-only

var schemaID → URL or null read-only

var schemaNamespace → String or null read-only

var stringEncoding → StringEncoding read-only

var topElement → XML.Element read-only

Returns the element at the top of the current element stack. Intially this is the root element, but when addElement() is called, it is temporarily updated to the new element (possibly recursively).

var whitespaceBehavior → XML.WhitespaceBehavior read-only

XML.Document.Configuration

Constructors

new XML.Document.Configuration() → XML.Document.Configuration

Returns a new XML.Document.Configuration with default settings.

Instance Properties

var dtdPublicID → String or null

var dtdSystemID → URL or null

var schemaID → URL or null

var schemaNamespace → String or null

var stringEncoding → StringEncoding

var whitespaceBehavior → XML.WhitespaceBehavior or null

XML.Element

Constructors

new XML.Element(name: String) → XML.Element

Returns a new XML.Element with the given name.

Instance Functions

function childAtIndex(childIndex: Number) → String or XML.Element or null

Returns the child at the given index, or nil if the index is past the last child.

function insertChild(child: String or XML.Element, childIndex: Number)

Inserts the new child at the specified index. If the index is past the end of the current children, it is appended instead.

function appendChild(child: String or XML.Element)

Adds the new item to the end of the children.

function removeChildAtIndex(childIndex: Number)

Removes the child at the given index. If the index is past the end of the current children, no removal occurs.

function removeAllChildren()

Removes any existing children.

function firstChildNamed(name: String) → XML.Element or null

Returns the first child element with the given name, or null if there is no such child.

function firstChildAtPath(path: String) → XML.Element or null

Given a path which is a string separated by "/", returns the first element at that path.

function firstChildWithAttribute(attribute: String, value: String) → XML.Element or null

Returns the first child with an attribute set to the given value.

function attributeNamed(name: String) → String or null

Returns the value of the the given attribute or null if no value has been assigned.

function setAttribute(name: String, value: String or null)

Sets the value for the specified attribute. If the element already had a value for this attribute, it is replaced in place. If there previously was no value for this attribute, the attribute is appended to attributeNames. If the new value is null, the attribute is removed.

function apply(function: Function(‍node: String or XML.Element‍) → ApplyResult or null) → ApplyResult or null

Calls the supplied function for each child element or string in the receiver (including the receiver), passing that child as the single argument. The supplied function can optionally return a ApplyResult to skip enumeration of some elements.

Instance Properties

var attributeCount → Number read-only

Returns the number of attributes assigned to this element.

var attributeNames → Array of String read-only

Returns the names of the attributes in the order they were added to the element.

var children → Array of String or XML.Element

The current child strings and elements.

var childrenCount → Number read-only

Returns the current count of child strings and elements.

var lastChild → String or XML.Element or null read-only

Returns the last child of the element, or null if there are no children.

var name → String read-only

Returns the name of the element.

var stringContents → String read-only

Gathers all the immediate and descendent string children and returns them concatenated them as single string.

XML.WhitespaceBehavior

Constructors

new XML.WhitespaceBehavior(defaultBehavior: XML.WhitespaceBehavior.Type) → XML.WhitespaceBehavior

Returns a new XML.WhitespaceBehavior with the given default type.

Instance Functions

function setBehaviorForElementName(behavior: XML.WhitespaceBehavior.Type, elementName: String)

function behaviorForElementName(elementName: String) → XML.WhitespaceBehavior.Type

Instance Properties

var defaultBehavior → XML.WhitespaceBehavior.Type read-only

XML.WhitespaceBehavior.Type

Class Properties

var Auto → XML.WhitespaceBehavior.Type read-only

Inherit the behavior from the enclosing element

var Ignore → XML.WhitespaceBehavior.Type read-only

Ignore whitespace

var Preserve → XML.WhitespaceBehavior.Type read-only

Preserve whitespace

var all → Array of XML.WhitespaceBehavior.Type read-only