addHandler (CIF JavaScript API Reference)

Add the subscriber to the events.

Syntax

Microsoft.CIFramework.addHandler(eventName, handlerFunction);

Parameters

Name Type Required Description
eventName string Yes Name of the event for which the handler is set.
The supported events are as follows:
  • onclicktoact: The event is invoked when the outbound communication (ClickToAct) enabled field is clicked.
  • onmodechanged: The event is invoked when the panel mode is manually toggled between Minimized (0) and Docked (1).
  • onsizechanged: The event is invoked when the panel size is manually changed by dragging.
  • onpagenavigate: The event is triggered before a navigation event occurs on the main page
  • onsendkbarticle: The event is invoked when the user clicks the send button on the KB control.
handlerFunction Function Yes The handler function is invoked when the any of the supported events trigger.

Example

The sample code demonstrates setting addHandler method for the onmodechanged event.

handlerFunction = function(eventData) {
console.log(eventData)
return Promise.resolve();
}

Microsoft.CIFramework.addHandler("onmodechanged", handlerFunction);