refactor: change isActive to isRunning and related language to reduce confusion with the API concept of session status "active"
This commit is contained in:
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();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user