From a4fcf4a0f2cc0847e60765fe6c3375b3394a1537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Wed, 15 Feb 2017 19:21:00 +0900 Subject: [PATCH] Server#close takes a callback function. --- socket.io/index.d.ts | 2 +- socket.io/socket.io-tests.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/socket.io/index.d.ts b/socket.io/index.d.ts index bf46ca1160..2333dc8fe2 100644 --- a/socket.io/index.d.ts +++ b/socket.io/index.d.ts @@ -180,7 +180,7 @@ declare namespace SocketIO { /** * Closes the server connection */ - close():void; + close( fn ?: () => void ):void; /** * The event fired when we get a new connection diff --git a/socket.io/socket.io-tests.ts b/socket.io/socket.io-tests.ts index 442e677751..ea3d97e21f 100644 --- a/socket.io/socket.io-tests.ts +++ b/socket.io/socket.io-tests.ts @@ -143,3 +143,14 @@ function testUsingItJustAsACrossBrowserWebSocket() { socket.on('disconnect', function () { }); }); } + +function testClosingServerWithCallback() { + var io = socketIO.listen(80); + io.close(function() { + }); +} + +function testClosingServerWithoutCallback() { + var io = socketIO.listen(80); + io.close(); +}