GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: replace callback with arrow functions · nodejs/node@4070152

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/pummel
    • test-net-throttle.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/pummel/test-net-throttle.js‎

Copy file name to clipboardExpand all lines: test/pummel/test-net-throttle.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const body = 'C'.repeat(N);
3434

3535
console.log(`start server on port ${common.PORT}`);
3636

37-
const server = net.createServer(function(connection) {
37+
const server = net.createServer((connection) => {
3838
connection.write(body.slice(0, part_N));
3939
connection.write(body.slice(part_N, 2 * part_N));
4040
assert.strictEqual(connection.write(body.slice(2 * part_N, N)), false);
@@ -44,11 +44,11 @@ const server = net.createServer(function(connection) {
4444
connection.end();
4545
});
4646

47-
server.listen(common.PORT, function() {
47+
server.listen(common.PORT, () => {
4848
let paused = false;
4949
const client = net.createConnection(common.PORT);
5050
client.setEncoding('ascii');
51-
client.on('data', function(d) {
51+
client.on('data', (d) => {
5252
chars_recved += d.length;
5353
console.log(`got ${chars_recved}`);
5454
if (!paused) {
@@ -57,7 +57,7 @@ server.listen(common.PORT, function() {
5757
paused = true;
5858
console.log('pause');
5959
const x = chars_recved;
60-
setTimeout(function() {
60+
setTimeout(() => {
6161
assert.strictEqual(chars_recved, x);
6262
client.resume();
6363
console.log('resume');
@@ -66,14 +66,14 @@ server.listen(common.PORT, function() {
6666
}
6767
});
6868

69-
client.on('end', function() {
69+
client.on('end', () => {
7070
server.close();
7171
client.end();
7272
});
7373
});
7474

7575

76-
process.on('exit', function() {
76+
process.on('exit', () => {
7777
assert.strictEqual(chars_recved, N);
7878
assert.strictEqual(npauses > 2, true);
7979
});

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.