open.item - Events - Author API

Author API Events

open:item

Fires when an Item in the Item 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 Item, for example.

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

Examples

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

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

Callback arguments

  • itemJson object

    JSON of the Item being opened. This does not include Questions or Features.

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.