Event Author API

open:activity

Fires when an Activity in the Activity list is clicked.

You would want to be notified about this event firing, because you might want to take some action when the author selects an Activity, for example.

When the event has fired, you can use event.preventDefault() to prevent the Activity from being opened.

Examples

// Standard usage to listen to the event
authorApp.on('open:activity', function (event) {
    console.log('This code executes when an Activity has been clicked.');
});

// Prevent navigating to a new page
authorApp.on('open:activity', function (event) {
    if (shouldNotOpenActivity) {
        event.preventDefault();
    }
});

Callback arguments

The event callback function will be called with an AuthorEvent instance as an argument (unless indicated otherwise). The AuthorEvent object provides further information for the event that has been fired. Additional data attributes listed below can be accessed from the event.data object. The AuthorEvent object will look like the example below:

authorApp.on('[name of the fired event]', function (event) {
    console.log(event);
    /*
        {
            "name": "[name of the fired event]",
            "data": {
                // additional data attributes
            }
        }
    */
});
  • activityJson object
    JSON of the Activity being opened.
Was this article helpful?