Docs (4.0.0)
Activities

class Activity

A class that represents a part of the application that can be activated when the user navigates to it.

class Activity
extends ManagedObject

Description

The activity is one of the main architectural components of a Desk application. It represents a potential ‘place’ in the application, which can be activated and deactivated when the user navigates around.

This class provides infrastructure for path-based routing, based on the application’s navigation path (such as the browser’s current URL). However, activities can also be activated and deactivated manually, or activated immediately when added using app.addActivity().

Activities emit Active and Inactive change events when state transitions occur.

This class also provides a view property, which can be set to a view object. Usually, this property is set in the Activity.ready() method. Afterwards, if the activity corresponds to a full page or dialog, this method should call app methods to show the view. The view is automatically unlinked when the activity is deactivated, and the property is set to undefined.

Example

// Create an activity and activate it:
class MyActivity extends Activity {
  navigationPageId = "foo";
  protected ready() {
    this.view = new body(); // imported from a view file
    app.showPage(this.view);
  }
}

app.addActivity(new MyActivity());
app.navigate("foo");

Constructor

Instance Members

Inherited Members