Extend NodeJS.EventEmitter

As seen here: https://github.com/yeoman/generator/blob/master/lib/base.js

``` JavaScript
var Base = module.exports = function Base(args, options) {
events.EventEmitter.call(this);
```
This commit is contained in:
Sergio Morchón Poveda 2015-02-24 17:57:02 +01:00
parent 293abd9b04
commit 022d3ea843

View File

@ -2,6 +2,7 @@
// Project: https://github.com/yeoman/generator
// Definitions by: Kentaro Okuno <http://github.com/armorik83>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module yo {
export interface IYeomanGenerator {
@ -20,7 +21,7 @@ declare module yo {
sourceRoot(rootPath: string): string;
}
export class YeomanGeneratorBase implements IYeomanGenerator {
export class YeomanGeneratorBase implements IYeomanGenerator, NodeJS.EventEmitter {
argument(name: string, config: IArgumentConfig): void;
composeWith(namespace: string, options: any, settings?: IComposeSetting): IYeomanGenerator;
defaultFor(name: string): void;
@ -34,6 +35,14 @@ declare module yo {
run(args: any, callback?: Function): void;
runHooks(callback?: Function): void;
sourceRoot(rootPath: string): string;
addListener(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): NodeJS.EventEmitter;
once(event: string, listener: Function): NodeJS.EventEmitter;
removeListener(event: string, listener: Function): NodeJS.EventEmitter;
removeAllListeners(event?: string): NodeJS.EventEmitter;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
}
export interface IArgumentConfig {