Merge pull request #2978 from zakki/socketioclient-nomodule

Add internal module definition for socket.io-client
This commit is contained in:
Masahiro Wakame
2014-10-16 11:53:39 +09:00
3 changed files with 19 additions and 2 deletions
@@ -0,0 +1,10 @@
import io = require('socket.io-client');
var socket = io.connect('http://localhost:80');
socket.on('connect', function () {
console.log('Connected!');
socket.emit('event', 'some test data', function () {
console.log('Sent some data.');
});
});
+1 -1
View File
@@ -1,4 +1,4 @@
import io = require('socket.io-client');
/// <reference path="socket.io-client.d.ts"/>
var socket = io.connect('http://localhost:80');
+8 -1
View File
@@ -4,9 +4,16 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "socket.io-client" {
export = io;
}
export function connect(host: string, details?: any): Socket;
declare var io: SocketIOStatic;
interface SocketIOStatic {
connect(host: string, details?: any): SocketIOClient.Socket;
}
declare module SocketIOClient {
interface EventEmitter {
emit(name: string, ...data: any[]): any;
on(ns: string, fn: Function): EventEmitter;