Skip to content

Commit

Permalink
node: now modules depend on events.EventEmitter, not NodeEventEmitter
Browse files Browse the repository at this point in the history
  • Loading branch information
loyd authored and Bartvds committed Apr 28, 2014
1 parent c40cc2d commit d100d10
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 33 deletions.
35 changes: 18 additions & 17 deletions browser-harness/browser-harness.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,28 @@
/// <reference path="../node/node.d.ts" />

declare module "browser-harness" {
import _events = require('events');

interface HarnessEvents extends NodeEventEmitter {
once(event: string, listener: (driver: Driver) => void): NodeEventEmitter;
once(event: 'ready', listener: (driver: Driver) => void): NodeEventEmitter;
interface HarnessEvents extends _events.EventEmitter {
once(event: string, listener: (driver: Driver) => void): _events.EventEmitter;
once(event: 'ready', listener: (driver: Driver) => void): _events.EventEmitter;

on(event: string, listener: (driver: Driver) => void): NodeEventEmitter;
on(event: 'ready', listener: (driver: Driver) => void): NodeEventEmitter;
on(event: string, listener: (driver: Driver) => void): _events.EventEmitter;
on(event: 'ready', listener: (driver: Driver) => void): _events.EventEmitter;
}

interface DriverEvents extends NodeEventEmitter {
once(event: string, listener: (text: string) => void): NodeEventEmitter;
once(event: 'console.log', listener: (text: string) => void): NodeEventEmitter;
once(event: 'console.warn', listener: (text: string) => void): NodeEventEmitter;
once(event: 'console.error', listener: (text: string) => void): NodeEventEmitter;
once(event: 'window.onerror', listener: (text: string) => void): NodeEventEmitter;

on(event: string, listener: (text: string) => void): NodeEventEmitter;
on(event: 'console.log', listener: (text: string) => void): NodeEventEmitter;
on(event: 'console.warn', listener: (text: string) => void): NodeEventEmitter;
on(event: 'console.error', listener: (text: string) => void): NodeEventEmitter;
on(event: 'window.onerror', listener: (text: string) => void): NodeEventEmitter;
interface DriverEvents extends _events.EventEmitter {
once(event: string, listener: (text: string) => void): _events.EventEmitter;
once(event: 'console.log', listener: (text: string) => void): _events.EventEmitter;
once(event: 'console.warn', listener: (text: string) => void): _events.EventEmitter;
once(event: 'console.error', listener: (text: string) => void): _events.EventEmitter;
once(event: 'window.onerror', listener: (text: string) => void): _events.EventEmitter;

on(event: string, listener: (text: string) => void): _events.EventEmitter;
on(event: 'console.log', listener: (text: string) => void): _events.EventEmitter;
on(event: 'console.warn', listener: (text: string) => void): _events.EventEmitter;
on(event: 'console.error', listener: (text: string) => void): _events.EventEmitter;
on(event: 'window.onerror', listener: (text: string) => void): _events.EventEmitter;
}

export interface Driver {
Expand Down
4 changes: 3 additions & 1 deletion msnodesql/msnodesql.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
///<reference path='../node/node.d.ts' />

declare module "msnodesql" {
import events = require('events');

export function open(connectionString: string, callback?: OpenCallback): Connection;

export function query(connectionString: string, query: string, callback?: QueryCallback): StreamEvents;
Expand Down Expand Up @@ -55,5 +57,5 @@ declare module "msnodesql" {
close(immediately: boolean, callback?: ErrorCallback);
}

interface StreamEvents extends NodeEventEmitter { }
interface StreamEvents extends events.EventEmitter {}
}
31 changes: 16 additions & 15 deletions node/node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/************************************************
* *
* Node.js v0.10.1 API *
* Node.js v0.10.1 API *
* *
************************************************/

Expand Down Expand Up @@ -256,15 +256,15 @@ declare module "http" {
import net = require("net");
import stream = require("stream");

export interface Server extends NodeEventEmitter {
export interface Server extends events.EventEmitter {
listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
listen(path: string, callback?: Function): Server;
listen(handle: any, listeningListener?: Function): Server;
close(cb?: any): Server;
address(): { port: number; family: string; address: string; };
maxHeadersCount: number;
}
export interface ServerRequest extends NodeEventEmitter, ReadableStream {
export interface ServerRequest extends events.EventEmitter, ReadableStream {
method: string;
url: string;
headers: any;
Expand All @@ -275,7 +275,7 @@ declare module "http" {
resume(): void;
connection: net.Socket;
}
export interface ServerResponse extends NodeEventEmitter, WritableStream {
export interface ServerResponse extends events.EventEmitter, WritableStream {
// Extended base methods
write(buffer: Buffer): boolean;
write(buffer: Buffer, cb?: Function): boolean;
Expand All @@ -301,7 +301,7 @@ declare module "http" {
end(str: string, encoding?: string, cb?: Function): void;
end(data?: any, encoding?: string): void;
}
export interface ClientRequest extends NodeEventEmitter, WritableStream {
export interface ClientRequest extends events.EventEmitter, WritableStream {
// Extended base methods
write(buffer: Buffer): boolean;
write(buffer: Buffer, cb?: Function): boolean;
Expand All @@ -322,7 +322,7 @@ declare module "http" {
end(str: string, encoding?: string, cb?: Function): void;
end(data?: any, encoding?: string): void;
}
export interface ClientResponse extends NodeEventEmitter, ReadableStream {
export interface ClientResponse extends events.EventEmitter, ReadableStream {
statusCode: number;
httpVersion: string;
headers: any;
Expand Down Expand Up @@ -507,8 +507,8 @@ declare module "https" {
};
export interface Server extends tls.Server { }
export function createServer(options: ServerOptions, requestListener?: Function): Server;
export function request(options: RequestOptions, callback?: (res: NodeEventEmitter) =>void ): http.ClientRequest;
export function get(options: RequestOptions, callback?: (res: NodeEventEmitter) =>void ): http.ClientRequest;
export function request(options: RequestOptions, callback?: (res: events.EventEmitter) =>void ): http.ClientRequest;
export function get(options: RequestOptions, callback?: (res: events.EventEmitter) =>void ): http.ClientRequest;
export var globalAgent: Agent;
}

Expand Down Expand Up @@ -540,14 +540,14 @@ declare module "repl" {
ignoreUndefined?: boolean;
writer?: Function;
}
export function start(options: ReplOptions): NodeEventEmitter;
export function start(options: ReplOptions): events.EventEmitter;
}

declare module "readline" {
import events = require("events");
import stream = require("stream");

export interface ReadLine extends NodeEventEmitter {
export interface ReadLine extends events.EventEmitter {
setPrompt(prompt: string, length: number): void;
prompt(preserveCursor?: boolean): void;
question(query: string, callback: Function): void;
Expand Down Expand Up @@ -582,7 +582,7 @@ declare module "child_process" {
import events = require("events");
import stream = require("stream");

export interface ChildProcess extends NodeEventEmitter {
export interface ChildProcess extends events.EventEmitter {
stdin: WritableStream;
stdout: ReadableStream;
stderr: ReadableStream;
Expand Down Expand Up @@ -743,7 +743,7 @@ declare module "dgram" {

export function createSocket(type: string, callback?: Function): Socket;

interface Socket extends NodeEventEmitter {
interface Socket extends events.EventEmitter {
send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: Function): void;
bind(port: number, address?: string): void;
close(): void;
Expand All @@ -758,6 +758,7 @@ declare module "dgram" {

declare module "fs" {
import stream = require("stream");
import events = require("events");

interface Stats {
isFile(): boolean;
Expand All @@ -782,7 +783,7 @@ declare module "fs" {
ctime: Date;
}

interface FSWatcher extends NodeEventEmitter {
interface FSWatcher extends events.EventEmitter {
close(): void;
}

Expand Down Expand Up @@ -1255,8 +1256,8 @@ declare module "domain" {

export class Domain extends events.EventEmitter {
run(fn: Function): void;
add(emitter: NodeEventEmitter): void;
remove(emitter: NodeEventEmitter): void;
add(emitter: events.EventEmitter): void;
remove(emitter: events.EventEmitter): void;
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
Expand Down

0 comments on commit d100d10

Please sign in to comment.