You can attach event handlers to certain events triggered by the UserDeck Knowledge Base widget.
Advanced widget integration
To access the app instance object, you must first complete an advanced widget integration.
Attaching event handlers
Once installed, you can listen to events on the Knowledge Base app instance by registering a callback using the on
method:
js
CopyEdit
UserDeck.factory('guides', { // Required... key: 'xxxxxxxx', el: '#guides' }).done(function (app) { // Listen for a viewArticle event. app.on('viewArticle', function (article) { // Custom logic here }); // Listen for an article.rateYes event. app.on('article.rateYes', function (article) { // Custom logic here }); });
Available events
Below are the events you can listen to using the Knowledge Base widget:
viewHome
viewCollection
(object:collection
)viewCategory
(object:category
)viewArticle
(object:article
)viewSearch
(string:terms
)article.rateYes
(object:article
)article.rateNo
(object:article
)showAdminModal
hideAdminModal