Skip to content

Commit 8596a89

Browse files
committed
Update notebook
1 parent da483c5 commit 8596a89

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

src/notebook.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,27 @@ class RKernel {
5555

5656
const client = net.createConnection({ port: this.port }, () => {
5757
console.log('connected to server!');
58+
client.on('data', (data) => {
59+
const result = data.toString();
60+
console.log(result);
61+
outputBuffer += result;
62+
client.end();
63+
});
64+
65+
client.on('end', () => {
66+
console.log('disconnected from server');
67+
});
68+
69+
const json = JSON.stringify({
70+
time: Date.now(),
71+
uri: cell.uri.toString(),
72+
expr: '1+1',
73+
});
74+
75+
console.log(`Send: ${json}`);
76+
client.write(json);
5877
});
5978

60-
client.on('data', (data) => {
61-
const result = data.toString();
62-
console.log(result);
63-
outputBuffer += result;
64-
client.end();
65-
});
66-
67-
client.on('end', () => {
68-
console.log('disconnected from server');
69-
});
70-
71-
const json = JSON.stringify({
72-
time: Date.now(),
73-
uri: cell.uri.toString(),
74-
expr: '1+1',
75-
});
76-
console.log(`Send: ${json}`);
77-
client.write(json);
78-
7979
return Promise.resolve(outputBuffer);
8080
}
8181
}

0 commit comments

Comments
 (0)