mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #865 from AndrewGaspar/socketio
Updated socket.io to have better function typing on SocketNamespace.on
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import io = require('socket.io');
|
||||
|
||||
var socketManager = io.listen(80);
|
||||
|
||||
socketManager.sockets.on('connection', socket => {
|
||||
socket.emit('news', { hello: 'world' });
|
||||
socket.on('my other event', data => {
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
Vendored
+1
-1
@@ -40,7 +40,7 @@ interface SocketNamespace {
|
||||
json: any;
|
||||
volatile: any;
|
||||
in(room: string): SocketNamespace;
|
||||
on(evt: string, fn: Function): SocketNamespace;
|
||||
on(evt: string, fn: (socket: Socket) => void): SocketNamespace;
|
||||
to(room: string): SocketNamespace;
|
||||
except(id: any): SocketNamespace;
|
||||
send(data: any): any;
|
||||
|
||||
Reference in New Issue
Block a user