realtime-tool
v1.0.0
Published
A JavaScript package for managing real-time collaboration sessions.
Downloads
3
Readme
Real-time Collaboration Tool
A JavaScript package for managing real-time collaboration sessions.
Installation
npm install real-time-collaboration-tool
Usage
const RealTimeCollaborationTool = require('realtime-tool');
// Create a new instance of the collaboration tool
const collaborationTool = new RealTimeCollaborationTool();
// Add users to the collaboration session
collaborationTool.addUser(1, 'User 1');
collaborationTool.addUser(2, 'User 2');
collaborationTool.addUser(3, 'User 3');
// Remove a user from the collaboration session
collaborationTool.removeUser(2);
// Get the list of all users in the collaboration session
const users = collaborationTool.getUsers();
console.log('Users in the session:', users);
API
addUser(userId, username)
Adds a new user to the collaboration session.
userId
: The unique identifier of the user.username
: The name of the user.
removeUser(userId)
Removes a user from the collaboration session.
userId
: The unique identifier of the user to remove.
getUsers()
Returns an array containing the usernames of all users currently in the collaboration session.
License
This project is licensed under the MIT License - see the LICENSE file for details.