mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
Merge pull request #2978 from zakki/socketioclient-nomodule
Add internal module definition for socket.io-client
This commit is contained in:
@@ -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,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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user