This repository has been archived by the owner on May 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d580763
commit 38bbd74
Showing
11 changed files
with
119 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import {Session, SessionID} from "../shell/Session"; | ||
import {ApplicationComponent} from "../views/ApplicationComponent"; | ||
|
||
export class SessionsService { | ||
private readonly sessions: Map<SessionID, Session> = new Map; | ||
|
||
create(application: ApplicationComponent) { | ||
const session = new Session(application); | ||
this.sessions.set(session.id, session); | ||
|
||
return session.id; | ||
} | ||
|
||
get(id: SessionID) { | ||
return this.sessions.get(id)!; | ||
} | ||
|
||
close(id: SessionID) { | ||
const session = this.get(id); | ||
|
||
session.jobs.forEach(job => { | ||
job.removeAllListeners(); | ||
job.interrupt(); | ||
}); | ||
|
||
session.removeAllListeners(); | ||
|
||
this.sessions.delete(id); | ||
} | ||
|
||
closeAll() { | ||
for (const id of this.sessions.keys()) { | ||
this.close(id); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.