JavaScript/jQuery Chat API
The Chat UI component is an interactive interface that allows users to send and receive messages in real time.
See Also
jQuery
Angular
Vue
React
Options
A configuration object for the Chat UI component.
| Name | Description |
|---|---|
| activeStateEnabled | Specifies whether the UI component changes its visual state as a result of user interaction. |
| alerts | A list of available alerts. |
| dataSource | Binds the UI component to data. |
| dayHeaderFormat | Specifies the day header format. |
| disabled | Specifies whether the UI component responds to user interaction. |
| editing | Configures editing. |
| elementAttr | Specifies the global attributes to be attached to the UI component's container element. |
| focusStateEnabled | Specifies whether the Chat's input element can be focused using keyboard navigation. |
| height | Specifies the UI component's height. |
| hoverStateEnabled | Specifies whether the UI component changes its state when a user pauses on it. |
| items | Specifies an array of chat messages. |
| messageComponent | An alias for the messageTemplate property specified in React. Accepts a custom component. Refer to Using a Custom Component for more information. |
| messageRender | An alias for the messageTemplate property specified in React. Accepts a rendering function. Refer to Using a Rendering Function for more information. |
| messageTemplate | Specifies a custom template for a chat message. |
| messageTimestampFormat | Specifies the message timestamp format. |
| onDisposing | A function that is executed before the UI component is disposed of. |
| onInitialized | A function used in JavaScript frameworks to save the UI component instance. |
| onMessageDeleted | A function that is executed after a message was removed from the UI. |
| onMessageDeleting | A function that is executed before a message is removed from the UI. |
| onMessageEditCanceled | A function that is executed after message changes are discarded. |
| onMessageEditingStart | A function that is executed before a message switches to the editing state. |
| onMessageEntered | A function that is executed after a message is entered into the chat. |
| onMessageUpdated | A function that is executed after a message was edited in the UI. |
| onMessageUpdating | A function that is executed before a message is edited in the UI. |
| onOptionChanged | A function that is executed after a UI component property is changed. |
| onTypingEnd | A function that is called 2 seconds after a user stops typing or after a message is entered. |
| onTypingStart | A function that is called after a user starts typing. |
| reloadOnChange | Specifies whether the Chat UI component displays newly entered messages immediately. This property only applies if dataSource is used. |
| rtlEnabled | Switches the UI component to a right-to-left representation. |
| showAvatar | Specifies whether to show avatars. |
| showDayHeaders | Specifies whether to show day headers. |
| showMessageTimestamp | Specifies whether to show message time stamps. |
| showUserName | Specifies whether to show user names. |
| typingUsers | An array of users who are currently typing. |
| user | Specifies the current chat user (messages displayed on the right side). |
| visible | Specifies whether the UI component is visible. |
| width | Specifies the UI component's width. |
See Also
Methods
| Name | Description |
|---|---|
| beginUpdate() | Postpones rendering that can negatively affect performance until the endUpdate() method is called. |
| defaultOptions(rule) | Specifies the device-dependent default configuration properties for this component. |
| dispose() | Disposes of all the resources allocated to the Chat instance. |
| element() | Gets the root UI component element. |
| endUpdate() | Refreshes the UI component after a call of the beginUpdate() method. |
| focus() | Sets focus to the Chat's input element. |
| getDataSource() | Gets the DataSource instance. |
| getInstance(element) | Gets the instance of a UI component found using its DOM node. |
| instance() | Gets the UI component's instance. Use it to access other methods of the UI component. |
| off(eventName) | Detaches all event handlers from a single event. |
| off(eventName, eventHandler) | Detaches a particular event handler from a single event. |
| on(eventName, eventHandler) | Subscribes to an event. |
| on(events) | Subscribes to events. |
| option() | Gets all UI component properties. |
| option(optionName) | Gets the value of a single property. |
| option(optionName, optionValue) | Updates the value of a single property. |
| option(options) | Updates the values of several properties. |
| registerKeyHandler(key, handler) | Registers a handler to be executed when a user presses a specific key. |
| renderMessage(message) | Renders a new message. |
| repaint() | Renders the component again without reloading data. Use the method to update the component's markup and appearance dynamically. |
| resetOption(optionName) | Resets a property to its default value. |
Events
| Name | Description |
|---|---|
| disposing | Raised before the UI component is disposed of. |
| initialized | Raised only once, after the UI component is initialized. |
| messageDeleted | Raised after a message is deleted. |
| messageDeleting | Raised before a message is deleted. |
| messageEditCanceled | Raised after message changes are discarded. |
| messageEditingStart | Raised before a message switches to the editing state. |
| messageEntered | Raised after a message is entered. |
| messageUpdated | Raised after a message was updated. |
| messageUpdating | Raised before a message is updated. |
| optionChanged | Raised after a UI component property is changed. |
| typingEnd | Raised 2 seconds after a user stopped typing or after a message is entered. |
| typingStart | Raised when a user starts typing. |
See Also
Types
| Name | Description |
|---|---|
| Alert | A configuration object for an alert. |
| DisposingEvent | The type of the disposing event handler's argument. |
| ImageMessage | Configures image message. |
| InitializedEvent | The type of the initialized event handler's argument. |
| Message | A configuration object for a message. |
| MessageDeletedEvent | The argument type in the messageDeleted event. |
| MessageDeletingEvent | The argument type in the messageDeleting event. |
| MessageEditCanceledEvent | The argument type in the messageEditCanceled event. |
| MessageEditingStartEvent | The argument type in the messageEditingStart event. |
| MessageEnteredEvent | The argument type in the messageEntered event. |
| MessageUpdatedEvent | The argument type in the messageUpdated event. |
| MessageUpdatingEvent | The argument type in the messageUpdating event. |
| OptionChangedEvent | The argument type in the optionChanged event. |
| TextMessage | Configures a text message. |
| TypingEndEvent | The argument type in the typingEnd event. |
| TypingStartEvent | The argument type in the typingStart. |
| User | A configuration object for a user. |