mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
remove socket.io/legacy and socket.io-client/legacy
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
import io = require('socket.io-client-0.9');
|
||||
|
||||
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,10 +0,0 @@
|
||||
/// <reference path="socket.io-client-0.9.d.ts"/>
|
||||
|
||||
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,40 +0,0 @@
|
||||
// Type definitions for socket.io nodejs client
|
||||
// Project: http://socket.io/
|
||||
// Definitions by: Maido Kaara <https://github.com/v3rm0n>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "socket.io-client-0.9" {
|
||||
export = io;
|
||||
}
|
||||
|
||||
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;
|
||||
addListener(ns: string, fn: Function): EventEmitter;
|
||||
removeListener(ns: string, fn: Function): EventEmitter;
|
||||
removeAllListeners(ns: string): EventEmitter;
|
||||
once(ns: string, fn: Function): EventEmitter;
|
||||
listeners(ns: string): Function[];
|
||||
}
|
||||
|
||||
interface SocketNamespace extends EventEmitter {
|
||||
of(name: string): SocketNamespace;
|
||||
send(data: any, fn: Function): SocketNamespace;
|
||||
emit(name: string): SocketNamespace;
|
||||
}
|
||||
|
||||
interface Socket extends EventEmitter {
|
||||
of(name: string): SocketNamespace;
|
||||
connect(fn: Function): Socket;
|
||||
packet(data: any): Socket;
|
||||
flushBuffer(): void;
|
||||
disconnect(): Socket;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/// <reference path="socket.io-client-1.2.0.d.ts"/>
|
||||
|
||||
function testUsingWithNodeHTTPServer() {
|
||||
var socket = io('http://localhost');
|
||||
socket.on('news', function (data: any) {
|
||||
console.log(data);
|
||||
socket.emit('my other event', { my: 'data' });
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingWithExpress() {
|
||||
var socket = io.connect('http://localhost');
|
||||
socket.on('news', function (data: any) {
|
||||
console.log(data);
|
||||
socket.emit('my other event', { my: 'data' });
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingWithTheExpressFramework() {
|
||||
var socket = io.connect('http://localhost');
|
||||
socket.on('news', function (data: any) {
|
||||
console.log(data);
|
||||
socket.emit('my other event', { my: 'data' });
|
||||
});
|
||||
}
|
||||
|
||||
function testRestrictingYourselfToANamespace() {
|
||||
var chat = io.connect('http://localhost/chat')
|
||||
, news = io.connect('http://localhost/news');
|
||||
|
||||
chat.on('connect', function () {
|
||||
chat.emit('hi!');
|
||||
});
|
||||
|
||||
news.on('news', function () {
|
||||
news.emit('woot');
|
||||
});
|
||||
}
|
||||
|
||||
function testSendingAndGettingData() {
|
||||
var socket = io();
|
||||
socket.on('connect', function () {
|
||||
socket.emit('ferret', 'tobi', function (data: any) {
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingItJustAsACrossBrowserWebSocket() {
|
||||
var socket = io('http://localhost/');
|
||||
socket.on('connect', function () {
|
||||
socket.emit('hi');
|
||||
|
||||
socket.on('message', function (msg: any) {
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
// Type definitions for socket.io-client 1.2.0
|
||||
// Project: http://socket.io/
|
||||
// Definitions by: PROGRE <https://github.com/progre/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var io: SocketIOClientStatic;
|
||||
|
||||
declare module 'socket.io-client' {
|
||||
export = io;
|
||||
}
|
||||
|
||||
interface SocketIOClientStatic {
|
||||
(host: string, details?: any): SocketIOClient.Socket;
|
||||
(details?: any): SocketIOClient.Socket;
|
||||
connect(host: string, details?: any): SocketIOClient.Socket;
|
||||
connect(details?: any): SocketIOClient.Socket;
|
||||
protocol: number;
|
||||
Socket: { new (...args: any[]): SocketIOClient.Socket };
|
||||
Manager: SocketIOClient.ManagerStatic;
|
||||
}
|
||||
|
||||
declare module SocketIOClient {
|
||||
interface Socket {
|
||||
on(event: string, fn: Function): Socket;
|
||||
once(event: string, fn: Function): Socket;
|
||||
off(event?: string, fn?: Function): Socket;
|
||||
emit(event: string, ...args: any[]): Socket;
|
||||
listeners(event: string): Function[];
|
||||
hasListeners(event: string): boolean;
|
||||
connected: boolean;
|
||||
}
|
||||
|
||||
interface ManagerStatic {
|
||||
(url: string, opts: any): SocketIOClient.Manager;
|
||||
new (url: string, opts: any): SocketIOClient.Manager;
|
||||
}
|
||||
|
||||
interface Manager {
|
||||
reconnection(v: boolean): Manager;
|
||||
reconnectionAttempts(v: boolean): Manager;
|
||||
reconnectionDelay(v: boolean): Manager;
|
||||
reconnectionDelayMax(v: boolean): Manager;
|
||||
timeout(v: boolean): Manager;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user