Reacting to widget events

You can attach event handlers to certain events triggered by the UserDeck Guides widget.

Advanced widget integration

You must first perform an advanced widget integration to gain access to the app instance object.

Attaching event handlers

Once installed, you can listen to events on the guides app instance object by registering a callback with the on method.

UserDeck.factory('guides', {
    // Required...
    key : 'xxxxxxxx',
    el : '#guides'
}).done(function (app) {
    // Listen for a viewArticle event.
    app.on('viewArticle', function (article) {
        //...
    });

    // Listen for an article.rateYes event.
    app.on('article.rateYes', function (article) {
        //...
    });
});

Available events

Here are the events (and their available arguments) triggered by the Guides widget:

  • viewHome
  • viewCollection [(obj) collection]
  • viewCategory [(obj) category]
  • viewArticle [(obj) article]
  • viewSearch [(string) terms]
  • article.rateYes [(obj) article]
  • article.rateNo [(obj) article]
  • showAdminModal
  • hideAdminModal
Was this article helpful?