[Node] Updating stream interfaces and removing redundant interfaces.

We duplicated the EventEmitter and Stream interfaces in the "event" module, so I removed the redundant interface definitions.

I have updated the ReadableStream/WritableStream interfaces in accordance with the current documentation:
http://nodejs.org/api/stream.html

I added class definitions for Writable/Transform/Duplex/PassThrough in 'event'. These classes are described in the following Node documentation:
http://nodejs.org/api/stream.html#stream_api_for_stream_implementors

As a result of these changes, I needed to slightly alter other typings to refer to the new interface name. This was unavoidable; I had to rename the `EventEmitter` interface to `NodeEventEmitter` to avoid clashing with the `events.EventEmitter` class that implements `NodeEventEmitter`.
This commit is contained in:
John Vilk
2014-02-05 14:28:10 -05:00
parent 16dd1ab76f
commit 87ac1b3421
6 changed files with 156 additions and 113 deletions
+7 -7
View File
@@ -124,7 +124,7 @@ declare module jake{
* @event stderr When the stderr for the child-process recieves data. This streams the stderr data. Passes one arg, the chunk of data.
* @event error When a shell-command
*/
export interface Exec extends EventEmitter{
export interface Exec extends NodeEventEmitter {
constructor(cmds:string[], callback?:()=>void, opts?:ExecOptions);
constructor(cmds:string[], opts?:ExecOptions, callback?:()=>void);
constructor(cmds:string, callback?:()=>void, opts?:ExecOptions);
@@ -182,7 +182,7 @@ declare module jake{
*
* @event complete
*/
export class Task implements EventEmitter {
export class Task implements NodeEventEmitter {
/**
* @name name The name of the Task
* @param prereqs Prerequisites to be run before this task
@@ -201,11 +201,11 @@ declare module jake{
*/
reenable(): void;
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
addListener(event: string, listener: Function): NodeEventEmitter;
on(event: string, listener: Function): NodeEventEmitter;
once(event: string, listener: Function): NodeEventEmitter;
removeListener(event: string, listener: Function): NodeEventEmitter;
removeAllListeners(event?: string): NodeEventEmitter;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, arg1?: any, arg2?: any): boolean;