Task

A Task object is used to represent a dynamically-defined task that the user can choose and invoke in the IDE’s task running interface. It allows customization of one or more standard actions in the tasks interface represented in the toolbar and menus.

The Task class is not subclassable.

Added in Nova 2.

Class Methods

constructor(name)

Creates a new task object with the provided user-readable name, as a string.

let task = new Task("Say Example");

task.setAction(Task.Build, new TaskProcessAction('/usr/bin/say', {
    args: ["I'm Building!"],
    env: {}
}));

task.setAction(Task.Run, new TaskProcessAction('/usr/bin/say', {
    args: ["I'm Running!"],
    env: {}
}));

task.setAction(Task.Clean, new TaskProcessAction('/usr/bin/say', {
    args: ["I'm Cleaning!"],
    env: {}
}));

Adding Actions

A task is constructed using one or more actions, which are represented by the following action classes:

To add an action to a task, invoke the setAction(name, action) method on the task, passing one of the action name constants (defined below in Class Properties) and an action object.

For any action name that does not have a corresponding action set, the corresponding button or menu item in the IDE will be disabled for the task.

Class Properties

Build

An action name used to denote an action bound to “Build”.

Clean

An action name used to denote an action bound to “Clean”.

Run

An action name used to denote an action bound to “Run”.

Properties

name

The user-readable name of the task as a String.

This property is settable.

image

The name of an image to show for the item (see Images for more information).

This property is settable.

buildBeforeRunning

If set to true, then invoking the “Run” action of the task will first invoke the “Build” task. By default, this is false.

This property is settable.

Added in Nova 5.

Methods

getAction(name)

Returns the action that is defined for the provided name, or undefined if no action is set.

setAction(name, action)

Sets an action for a provided name. If action is null or undefined the action will be removed from the task.