src/session/RemoteSession.js
/**
* This class is used to define a remote session where user has created
* a session.
*/
export class RemoteSession {
/**
* Create a new RemoteSession instance with provided data
*
* @param {string} id session's identifier
* @param {string} name session's name
* @protected
*/
constructor(id, name) {
if (typeof id !== 'string') {
throw new TypeError(`id parameter must be an string instead ${typeof id}`);
}
if (typeof name !== 'string') {
throw new TypeError(`name parameter must be an string instead ${typeof name}`);
}
/**
* Session's identifier
* @private
* @type {string}
*/
this._id = id;
/**
* Session's name
* @private
* @type {string}
*/
this._name = name;
}
/**
* Returns identifier associated with this session
* @type {string}
*/
get id() {
return this._id;
}
/**
* Returns name associated with this session
* @type {string}
*/
get name() {
return this._name;
}
}