Session Events

content_changed

Emitted when the document content has been updated due to changes made by remote users in the session.

//emitted whenever remote changes have updated the document
codox.on("content_changed", function(){
});

This event allows for post-content-update actions, such as triggering third party plugins that can perform any number of actions, such as word-counting, spellchecking, or taking content snapshots

note: this event will not be emitted for a user's own document edits.

users_update

Emitted every time a new user joins a session or an existing user leaves a session

//emitted whenever a user joins or leaves the session
codox.on("users_update", function(data){
});

The event'sdata object is an array that contains the current snapshot of users currently connected to the session. Each element of the array is a JSON object defined as follows:

Key

Value

user

object

joinTime

Date

The user object will contain all the user meta-data that was supplied to the initialization config parameter.

As an example, the data object might look like:

[{
"user":{
"name": "Hari",
"email": "hari@foundation.org",
"id": "001";
},
"joinTime": Mon Sep 02 2019 16:28:47 GMT-0700 (Pacific Daylight Time) {}
},
{
"name": {
"name": "Salvor",
"email": "salvor@foundation.org",
"id": "002"
},
"joinTime": Mon Sep 02 2019 16:38:47 GMT-0700 (Pacific Daylight Time) {}

If you plan to roll your own avatar component implementation, this event provides the data you need to render and update the list of "online" users.