MCPcopy
hub / github.com/nirui/sshwifty / constructor

Method constructor

ui/control/ssh.js:23–57  ·  view source on GitHub ↗
(data, color)

Source from the content-addressed store, hash-verified

21
22class Control {
23 constructor(data, color) {
24 this.colorM = color;
25 this.colors = this.colorM.get();
26
27 this.enable = false;
28 this.sender = data.send;
29 this.closer = data.close;
30 this.resizer = data.resize;
31 this.subs = new subscribe.Subscribe();
32
33 let self = this;
34
35 data.events.place("stdout", async rd => {
36 try {
37 self.subs.resolve(await reader.readCompletely(rd));
38 } catch (e) {
39 // Do nothing
40 }
41 });
42
43 data.events.place("stderr", async rd => {
44 try {
45 self.subs.resolve(await reader.readCompletely(rd));
46 } catch (e) {
47 // Do nothing
48 }
49 });
50
51 data.events.place("completed", () => {
52 self.closed = true;
53 self.colorM.forget(self.colors.color);
54
55 self.subs.reject("Remote connection has been terminated");
56 });
57 }
58
59 echo() {
60 return false;

Callers

nothing calls this directly

Calls 5

placeMethod · 0.80
forgetMethod · 0.80
getMethod · 0.45
resolveMethod · 0.45
rejectMethod · 0.45

Tested by

no test coverage detected