refactor: change isActive to isRunning and related language to reduce confusion with the API concept of session status "active"

This commit is contained in:
Randall Morey committed 2021-05-17 16:33:34 -04:00
1 parent a1b0481db9
commit ee29f3c599
2 files changed
+6 -6

No files matched your search

@@ -4,11 +4,11 @@ class SessionManager {
#sessions = [];
/**
* Checks for active sessions
* Checks for running sessions
* @returns {boolean}
*/
get hasActiveSessions() {
return Boolean(this.#sessions.find((session) => session.isActive));
get hasRunningSessions() {
return Boolean(this.#sessions.find((session) => session.isRunning));
}
/**
@@ -36,7 +36,7 @@ class Session {
/**
* @return {boolean}
*/
get isActive() {
get isRunning() {
return !this.#process.killed;
}
@@ -60,12 +60,12 @@ class Session {
*/
stop() {
return new Promise((resolve, reject) => {
if (this.isActive) {
if (this.isRunning) {
this.#process.on('close', () => resolve());
this.#process.on('error', (e) => reject(e));
this.#process.kill();
} else {
// Do nothing when process isn't active
// Do nothing when process isn't running
resolve();
}
});