Some actions that happen in the new frontend trigger an event. Events can be accessed liked that:
window.infoq.event.on('eventName', callback)
infoq.event.on('follow', function(e) {
console.log('Event payload: ', e)
})
where eventName is one of the following:
-
loaded
(infoq.js for the new frontend has loaded)null
-
closed
(an item was closed - part of closeables)var type data closeable
HTMLElement the item that gets removed on click -
tabChange
(Whenever a tab has changed)var type data instance
HTMLElement the containing .tabs element payload
Object { id: String, index: Number} -
follow
(an user or topic gets followed/unfollowed)var type data id
String user/topic's id trkRef
String tracking Reference id based on data-trk-ref of closest element segment
String Depending on the followed item can be 'user' or 'topic' flag
Bool Follow status -
like
(a topic gets liked/unliked)var type data id
String topic's id type
String Depending on the followed item can be 'content' or 'comment' trkRef
String tracking Reference id based on data-trk-ref of closest element title
String topic's title path
String topic's path aids
Array only for content: topic's authors' ids flag
Bool Like status commenterId
String only for comments: commenting author's id commentSubject
String only for comments: comment subject -
login
(login modal was triggered from a button)var type data ref
String login call reference - TODO #66 -
modalOpen
(when a modal is triggered)var type data containingItem
HTMLElement modal's containing item -
modalClose
(when the modal closes)null
-
notificationsReadAll
(read all notifications button clicked)null
-
notificationRead
(a notification 'Mark as read' button clicked)var type data id
String notification's id based on - el
-
notificationsTriggered
(notifications dropdown was opened)null
Please let me know if you would require additional hooks for implementation and if this document suits the implementation needs.