Codox
Search…
Session Events

content_changed

Emitted when the document content has been updated due to changes made by any user in the session.
1
// invoked whenever the document has been updated
2
codox.on("content_changed", function(data){
3
// data.source === 'local' for local changes
4
// data.source === 'remote' for remote changes
5
});
Copied!
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
If your application listens to the editor 'onChanged' event to trigger actions like saving document content to the backend, it should instead listen to this 'content_changed' or use the hook equivalent.
note: this hook will not be invoked when edits are made by the local user.
From v1.3.3, contentChanged hook will be invoked for both local and remote updates

users_update

Emitted every time a new user joins a session or an existing user leaves a session
1
//emitted whenever a user joins or leaves the session
2
codox.on("users_update", function(data){
3
});
Copied!
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:
1
[{
2
"user":{
3
"name": "Hari",
4
"email": "[email protected]",
5
"id": "001";
6
},
7
"joinTime": Mon Sep 02 2019 16:28:47 GMT-0700 (Pacific Daylight Time) {}
8
},
9
{
10
"name": {
11
"name": "Salvor",
12
"email": "[email protected]",
13
"id": "002"
14
},
15
"joinTime": Mon Sep 02 2019 16:38:47 GMT-0700 (Pacific Daylight Time) {}
Copied!
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.
Last modified 1yr ago