chore: Reapply stopping all session in desktop after merge

This commit is contained in:
Susmitha Girumala committed 2021-05-12 15:46:40 -04:00
1 parent c2c63294f4
commit 542b469ad8
1 file changed
+10 -1
@@ -3,6 +3,14 @@ const Session = require('./session.js');
class SessionManager {
#sessions = [];
/**
* Checks for active sessions
* @returns {boolean}
*/
get hasActiveSessions() {
return Boolean(this.#sessions.find((session) => session.isActive));
}
/**
* Start a session and track it.
* Returns session proxy details if successfully started.
@@ -23,10 +31,11 @@ class SessionManager {
*/
stopById(session_id) {
const session = this.#sessions.find((session) => session.id === session_id);
return session.stop();
return session && session.stop();
}
stopAll() {
this.#sessions.forEach((session) => session.stop());
}
}