node: improved EventEmitter's definition with this-typing

This commit is contained in:
Ilya Mochalov
2016-02-25 02:10:08 +05:00
parent dade441471
commit abc2bcfb85
28 changed files with 321 additions and 359 deletions
+10 -10
View File
@@ -96,44 +96,44 @@ declare module "apn" {
/**
* Emitted when an error occurs during initialisation of the module, usually due to a problem with the keys and certificates.
*/
on(event: "error", listener: (error:Error) => void):Connection;
on(event: "error", listener: (error:Error) => void):this;
/**
* Emitted when the connection socket experiences an error. This may be useful for debugging but no action should be necessary.
*/
on(event: "socketError", listener: (error:Error) => void):Connection;
on(event: "socketError", listener: (error:Error) => void):this;
/**
* Emitted when a notification has been sent to Apple - not a guarantee that it has been accepted by Apple, an error relating to it may occur later on. A notification may also be "transmitted" several times if a preceding notification caused an error requiring retransmission.
*/
on(event: "transmitted", listener: (notification:Notification, decive:Device) => void):Connection;
on(event: "transmitted", listener: (notification:Notification, decive:Device) => void):this;
/**
* Emitted when all pending notifications have been transmitted to Apple and the pending queue is empty. This may be called more than once if a notification error occurs and notifications must be re-sent.
*/
on(event: "completed", listener: () => void):Connection;
on(event: "completed", listener: () => void):this;
/**
* Emitted when Apple returns a notification as invalid but the notification has already been expunged from the cache - usually due to high throughput and indicates that notifications will be getting lost. The parameter is an estimate of how many notifications have been lost. You should experiment with increasing the cache size or enabling ```autoAdjustCache``` if you see this frequently.
*
* **Note**: With ```autoAdjustCache``` enabled this event will still be emitted when an adjustment is triggered.
*/
on(event: "cacheTooSmall", listener: (sizeDifference:number) => void):Connection;
on(event: "cacheTooSmall", listener: (sizeDifference:number) => void):this;
/**
* Emitted when a connection to Apple is successfully established. The parameter indicates the number of open connections. No action is required as the connection is managed internally.
*/
on(event: "connected", listener: (openSockets:net.Socket[]) => void):Connection;
on(event: "connected", listener: (openSockets:net.Socket[]) => void):this;
/**
* Emitted when the connection to Apple has been closed, this could be for numerous reasons, for example an error has occurred or the connection has timed out. The parameter is the same as for `connected` and again, no action is required.
*/
on(event: "disconnected", listener: (openSockets:net.Socket[]) => void):Connection;
on(event: "disconnected", listener: (openSockets:net.Socket[]) => void):this;
/**
* Emitted when the connectionTimeout option has been specified and no activity has occurred on a socket for a specified duration. The socket will be closed immediately after this event and a `disconnected` event will also be emitted.
*/
on(event: "timeout", listener: () => void):Connection;
on(event: "timeout", listener: () => void):this;
/**
* Emitted when a message has been received from Apple stating that a notification was invalid or if an internal error occurred before that notification could be pushed to Apple. If the notification is still in the cache it will be passed as the second argument, otherwise null. Where possible the associated `Device` object will be passed as a third parameter, however in cases where the token supplied to the module cannot be parsed into a `Buffer` the supplied value will be returned.
* Error codes smaller than 512 correspond to those returned by Apple as per their [docs][errors]. Other errors are applicable to `node-apn` itself. Definitions can be found in `lib/errors.js`.
*/
on(event: "transmissionError", listener: (errorCode:number, notification:Notification, device:Device|Buffer) => void):Connection;
on(event: string, listener: Function):Connection;
on(event: "transmissionError", listener: (errorCode:number, notification:Notification, device:Device|Buffer) => void):this;
on(event: string, listener: Function):this;
}
export interface NotificationAlertOptions {
title?:string;
+15 -15
View File
@@ -9,25 +9,25 @@ declare module "browser-harness" {
import _events = require('events');
interface HarnessEvents extends _events.EventEmitter {
once(event: string, listener: (driver: Driver) => void): _events.EventEmitter;
once(event: 'ready', listener: (driver: Driver) => void): _events.EventEmitter;
once(event: string, listener: (driver: Driver) => void): this;
once(event: 'ready', listener: (driver: Driver) => void): this;
on(event: string, listener: (driver: Driver) => void): _events.EventEmitter;
on(event: 'ready', listener: (driver: Driver) => void): _events.EventEmitter;
on(event: string, listener: (driver: Driver) => void): this;
on(event: 'ready', listener: (driver: Driver) => void): this;
}
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;
once(event: string, listener: (text: string) => void): this;
once(event: 'console.log', listener: (text: string) => void): this;
once(event: 'console.warn', listener: (text: string) => void): this;
once(event: 'console.error', listener: (text: string) => void): this;
once(event: 'window.onerror', listener: (text: string) => void): this;
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;
on(event: string, listener: (text: string) => void): this;
on(event: 'console.log', listener: (text: string) => void): this;
on(event: 'console.warn', listener: (text: string) => void): this;
on(event: 'console.error', listener: (text: string) => void): this;
on(event: 'window.onerror', listener: (text: string) => void): this;
}
export interface Driver {
@@ -130,4 +130,4 @@ declare module "browser-harness" {
timeoutMS: number;
retryMS: number;
};
}
}
+6 -6
View File
@@ -149,25 +149,25 @@ declare module Browserify {
* When a file is resolved for the bundle, the bundle emits a 'file' event with the full file path, the id string passed to require(), and the parent object used by browser-resolve.
* You could use the file event to implement a file watcher to regenerate bundles when files change.
*/
on(event: 'file', listener: (file: string, id: string, parent: any) => any): BrowserifyObject;
on(event: 'file', listener: (file: string, id: string, parent: any) => any): this;
/**
* When a package.json file is read, this event fires with the contents.
* The package directory is available at pkg.__dirname.
*/
on(event: 'package', listener: (pkg: any) => any): BrowserifyObject;
on(event: 'package', listener: (pkg: any) => any): this;
/**
* When .bundle() is called, this event fires with the bundle output stream.
*/
on(event: 'bundle', listener: (bundle: NodeJS.ReadableStream) => any): BrowserifyObject;
on(event: 'bundle', listener: (bundle: NodeJS.ReadableStream) => any): this;
/**
* When the .reset() method is called or implicitly called by another call to .bundle(), this event fires.
*/
on(event: 'reset', listener: () => any): BrowserifyObject;
on(event: 'reset', listener: () => any): this;
/**
* When a transform is applied to a file, the 'transform' event fires on the bundle stream with the transform stream tr and the file that the transform is being applied to.
*/
on(event: 'transform', listener: (tr: NodeJS.ReadWriteStream, file: string) => any): BrowserifyObject;
on(event: string, listener: Function): BrowserifyObject;
on(event: 'transform', listener: (tr: NodeJS.ReadWriteStream, file: string) => any): this;
on(event: string, listener: Function): this;
/**
* Set to any until substack/labeled-stream-splicer is defined
+48 -48
View File
@@ -97,12 +97,12 @@ declare module Electron {
}
class Screen implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): Screen;
on(event: string, listener: Function): Screen;
once(event: string, listener: Function): Screen;
removeListener(event: string, listener: Function): Screen;
removeAllListeners(event?: string): Screen;
setMaxListeners(n: number): Screen;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -134,12 +134,12 @@ declare module Electron {
* You can also create a window without chrome by using Frameless Window API.
*/
class BrowserWindow implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): WebContents;
on(event: string, listener: Function): WebContents;
once(event: string, listener: Function): WebContents;
removeListener(event: string, listener: Function): WebContents;
removeAllListeners(event?: string): WebContents;
setMaxListeners(n: number): WebContents;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -541,12 +541,12 @@ declare module Electron {
* A WebContents is responsible for rendering and controlling a web page.
*/
class WebContents implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): WebContents;
on(event: string, listener: Function): WebContents;
once(event: string, listener: Function): WebContents;
removeListener(event: string, listener: Function): WebContents;
removeAllListeners(event?: string): WebContents;
setMaxListeners(n: number): WebContents;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -959,12 +959,12 @@ declare module Electron {
}
class App implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): App;
on(event: string, listener: Function): App;
once(event: string, listener: Function): App;
removeListener(event: string, listener: Function): App;
removeAllListeners(event?: string): App;
setMaxListeners(n: number): App;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1166,12 +1166,12 @@ declare module Electron {
}
class AutoUpdater implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): AutoUpdater;
on(event: string, listener: Function): AutoUpdater;
once(event: string, listener: Function): AutoUpdater;
removeListener(event: string, listener: Function): AutoUpdater;
removeAllListeners(event?: string): AutoUpdater;
setMaxListeners(n: number): AutoUpdater;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1286,12 +1286,12 @@ declare module Electron {
}
class Tray implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): Tray;
on(event: string, listener: Function): Tray;
once(event: string, listener: Function): Tray;
removeListener(event: string, listener: Function): Tray;
removeAllListeners(event?: string): Tray;
setMaxListeners(n: number): Tray;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1478,12 +1478,12 @@ declare module Electron {
// Type definitions for renderer process
export class IpcRenderer implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): IpcRenderer;
on(event: string, listener: Function): IpcRenderer;
once(event: string, listener: Function): IpcRenderer;
removeListener(event: string, listener: Function): IpcRenderer;
removeAllListeners(event?: string): IpcRenderer;
setMaxListeners(n: number): IpcRenderer;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1510,16 +1510,16 @@ declare module Electron {
}
class IPCMain implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): IPCMain;
once(event: string, listener: Function): IPCMain;
removeListener(event: string, listener: Function): IPCMain;
removeAllListeners(event?: string): IPCMain;
setMaxListeners(n: number): IPCMain;
addListener(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
on(event: string, listener: (event: IPCMainEvent, ...args: any[]) => any): IPCMain;
on(event: string, listener: (event: IPCMainEvent, ...args: any[]) => any): this;
}
interface IPCMainEvent {
+6 -7
View File
@@ -72,12 +72,12 @@ declare module "gulp-nodemon" {
}
interface EventEmitter extends NodeJS.EventEmitter {
addListener(event: string, listener: Function): EventEmitter;
addListener(event: string, tasks: string[]): EventEmitter;
on(event: string, listener: Function): EventEmitter;
on(event: string, tasks: string[]): EventEmitter;
once(event: string, listener: Function): EventEmitter;
once(event: string, tasks: string[]): EventEmitter;
addListener(event: string, listener: Function): this;
addListener(event: string, tasks: string[]): this;
on(event: string, listener: Function): this;
on(event: string, tasks: string[]): this;
once(event: string, listener: Function): this;
once(event: string, tasks: string[]): this;
}
}
@@ -85,4 +85,3 @@ declare module "gulp-nodemon" {
export = nodemon;
}
+11 -11
View File
@@ -226,17 +226,17 @@ declare module jake{
*/
reenable(): void;
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): NodeJS.EventEmitter;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
value: any;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
value: any;
}
export class DirectoryTask{
+10 -11
View File
@@ -58,9 +58,9 @@ declare module 'mailparser' {
class MailParser implements WritableStream {
constructor(options? : Options);
on(event : string, callback : (any : any) => void) : void;
constructor(options?: Options);
on(event: string, callback: (any: any) => void): this;
// from WritableStream
writable: boolean;
write(buffer: Buffer, cb?: Function): boolean;
@@ -70,19 +70,18 @@ declare module 'mailparser' {
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
// from EventEmitter
static listenerCount(emitter: EventEmitter, event: string): number;
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;
setMaxListeners(n: number): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
}
}
+18 -18
View File
@@ -37,11 +37,11 @@ declare module "noble" {
writeHandle(handle: NodeBuffer, data: NodeBuffer, withoutResponse: boolean, callback: (error: string) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
on(event: "connect", listener: (error: string) => void): events.EventEmitter;
on(event: "disconnect", listener: (error: string) => void): events.EventEmitter;
on(event: "rssiUpdate", listener: (rssi: number) => void): events.EventEmitter;
on(event: "servicesDiscover", listener: (services: Service[]) => void): events.EventEmitter;
on(event: string, listener: Function): this;
on(event: "connect", listener: (error: string) => void): this;
on(event: "disconnect", listener: (error: string) => void): this;
on(event: "rssiUpdate", listener: (rssi: number) => void): this;
on(event: "servicesDiscover", listener: (services: Service[]) => void): this;
}
export interface Advertisement {
@@ -63,9 +63,9 @@ declare module "noble" {
discoverCharacteristics(characteristicUUIDs: string[], callback?: (error: string, characteristics: Characteristic[]) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
on(event: "includedServicesDiscover", listener: (includedServiceUuids: string[]) => void): events.EventEmitter;
on(event: "characteristicsDiscover", listener: (characteristics: Characteristic[]) => void): events.EventEmitter;
on(event: string, listener: Function): this;
on(event: "includedServicesDiscover", listener: (includedServiceUuids: string[]) => void): this;
on(event: "characteristicsDiscover", listener: (characteristics: Characteristic[]) => void): this;
}
export class Characteristic extends events.EventEmitter {
@@ -82,13 +82,13 @@ declare module "noble" {
discoverDescriptors(callback?: (error: string, descriptors: Descriptor[]) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
on(event: string, option: boolean, listener: Function): events.EventEmitter;
on(event: "read", listener: (data: NodeBuffer, isNotification: boolean) => void): events.EventEmitter;
on(event: "write", withoutResponse: boolean, listener: (error: string) => void): events.EventEmitter;
on(event: "broadcast", listener: (state: string) => void): events.EventEmitter;
on(event: "notify", listener: (state: string) => void): events.EventEmitter;
on(event: "descriptorsDiscover", listener: (descriptors: Descriptor[]) => void): events.EventEmitter;
on(event: string, listener: Function): this;
on(event: string, option: boolean, listener: Function): this;
on(event: "read", listener: (data: NodeBuffer, isNotification: boolean) => void): this;
on(event: "write", withoutResponse: boolean, listener: (error: string) => void): this;
on(event: "broadcast", listener: (state: string) => void): this;
on(event: "notify", listener: (state: string) => void): this;
on(event: "descriptorsDiscover", listener: (descriptors: Descriptor[]) => void): this;
}
export class Descriptor extends events.EventEmitter {
@@ -100,9 +100,9 @@ declare module "noble" {
writeValue(data: NodeBuffer, callback?: (error: string) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
on(event: "valueRead", listener: (error: string, data: NodeBuffer) => void): events.EventEmitter;
on(event: "valueWrite", listener: (error: string) => void): events.EventEmitter;
on(event: string, listener: Function): this;
on(event: "valueRead", listener: (error: string, data: NodeBuffer) => void): this;
on(event: "valueWrite", listener: (error: string) => void): this;
}
}
+10 -16
View File
@@ -87,11 +87,11 @@ declare module NodeJS {
}
export interface EventEmitter {
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): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -259,11 +259,11 @@ declare module "events" {
export class EventEmitter implements NodeJS.EventEmitter {
static listenerCount(emitter: EventEmitter, event: string): number;
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): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1389,12 +1389,6 @@ declare module "domain" {
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): Domain;
on(event: string, listener: Function): Domain;
once(event: string, listener: Function): Domain;
removeListener(event: string, listener: Function): Domain;
removeAllListeners(event?: string): Domain;
}
export function create(): Domain;
+10 -16
View File
@@ -87,11 +87,11 @@ declare module NodeJS {
}
export interface EventEmitter {
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): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -259,11 +259,11 @@ declare module "events" {
export class EventEmitter implements NodeJS.EventEmitter {
static listenerCount(emitter: EventEmitter, event: string): number;
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): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1312,12 +1312,6 @@ declare module "domain" {
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): Domain;
on(event: string, listener: Function): Domain;
once(event: string, listener: Function): Domain;
removeListener(event: string, listener: Function): Domain;
removeAllListeners(event?: string): Domain;
}
export function create(): Domain;
+10 -16
View File
@@ -168,11 +168,11 @@ declare module NodeJS {
}
export interface EventEmitter {
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): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -415,11 +415,11 @@ declare module "events" {
export class EventEmitter implements NodeJS.EventEmitter {
static listenerCount(emitter: EventEmitter, event: string): number;
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): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1844,12 +1844,6 @@ declare module "domain" {
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): Domain;
on(event: string, listener: Function): Domain;
once(event: string, listener: Function): Domain;
removeListener(event: string, listener: Function): Domain;
removeAllListeners(event?: string): Domain;
}
export function create(): Domain;
+12 -18
View File
@@ -174,12 +174,12 @@ declare module NodeJS {
}
export interface EventEmitter {
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;
setMaxListeners(n: number): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -440,12 +440,12 @@ declare module "events" {
static listenerCount(emitter: EventEmitter, event: string): number; // deprecated
static defaultMaxListeners: number;
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;
setMaxListeners(n: number): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1958,12 +1958,6 @@ declare module "domain" {
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): Domain;
on(event: string, listener: Function): Domain;
once(event: string, listener: Function): Domain;
removeListener(event: string, listener: Function): Domain;
removeAllListeners(event?: string): Domain;
}
export function create(): Domain;
+8 -8
View File
@@ -108,7 +108,7 @@ declare module 'parse5' {
* The resulting document node.
*/
document: ASTNode;
on(event: string, listener: Function): ParserStream;
on(event: string, listener: Function): this;
/**
* Raised then parser encounters a <script> element. If this event has listeners, parsing will be suspended
* once it is emitted. So, if <script> has the src attribute,
@@ -117,44 +117,44 @@ declare module 'parse5' {
* The script element that caused the event, a function for writing additional html at the current parsing position. Suitable for implementing the DOM document.write and document.writeln methods.
* And finally a resume function as a callback to signal the continuation of the parsing
*/
on(event: 'script', listener: (scriptElement: ASTNode, documentWrite: (html: string) => void, resume: Function) => void): ParserStream;
on(event: 'script', listener: (scriptElement: ASTNode, documentWrite: (html: string) => void, resume: Function) => void): this;
}
export class SAXParser extends stream.Transform {
constructor(options?: SAXParserOptions);
on(event: string, listener: Function): events.EventEmitter;
on(event: string, listener: Function): this;
/**
* Raised when the parser encounters a start tag.
* Listener function has 4 parameters:
* Tag name, List of attributes in the { key: String, value: String } form, selfClosing boolean
* and start tag source code location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'startTag', listener: (name: string, attrs: Attribute[], selfClosing: boolean, location?: StartTagLocationInfo) => void): SAXParser;
on(event: 'startTag', listener: (name: string, attrs: Attribute[], selfClosing: boolean, location?: StartTagLocationInfo) => void): this;
/**
* Raised when parser encounters an end tag.
* Listener function has 2 parameters:
* Tag name and location End tag source code location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'endTag', listener: (name: string, location?: LocationInfo) => void): SAXParser;
on(event: 'endTag', listener: (name: string, location?: LocationInfo) => void): this;
/**
* Raised then parser encounters a comment.
* Listener function has 2 parameters:
* The comment text and the source code location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'comment', listener: (text: string, location?: LocationInfo) => void): SAXParser;
on(event: 'comment', listener: (text: string, location?: LocationInfo) => void): this;
/**
* Raised then parser encounters text content.
* Listener function has 2 parameters:
* The text content and location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'text', listener: (text: string, location?: LocationInfo) => void): SAXParser;
on(event: 'text', listener: (text: string, location?: LocationInfo) => void): this;
/**
* Raised then parser encounters a document type declaration.
* Listener function has 4 parameters:
* The document type name, document type public identifier, document type system identifier and
* location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'doctype', listener: (name: string, publicId: string, systemId: string, location?: LocationInfo) => void): SAXParser;
on(event: 'doctype', listener: (name: string, publicId: string, systemId: string, location?: LocationInfo) => void): this;
/**
* Stops parsing. Useful if you want the parser to stop consuming CPU time once you've obtained the desired info from the input stream.
* Doesn't prevent piping, so that data will flow through the parser as usual.
Vendored
+12 -12
View File
@@ -67,22 +67,22 @@ declare module "pg" {
pauseDrain(): void;
resumeDrain(): void;
public on(event: "drain", listener: () => void): Client;
public on(event: "error", listener: (err: Error) => void): Client;
public on(event: "notification", listener: (message: any) => void): Client;
public on(event: "notice", listener: (message: any) => void): Client;
public on(event: string, listener: Function): Client;
public on(event: "drain", listener: () => void): this;
public on(event: "error", listener: (err: Error) => void): this;
public on(event: "notification", listener: (message: any) => void): this;
public on(event: "notice", listener: (message: any) => void): this;
public on(event: string, listener: Function): this;
}
export class Query extends events.EventEmitter {
public on(event: "row", listener: (row: any, result?: ResultBuilder) => void): Query;
public on(event: "error", listener: (err: Error) => void): Query;
public on(event: "end", listener: (result: ResultBuilder) => void): Query;
public on(event: string, listener: Function): Query;
public on(event: "row", listener: (row: any, result?: ResultBuilder) => void): this;
public on(event: "error", listener: (err: Error) => void): this;
public on(event: "end", listener: (result: ResultBuilder) => void): this;
public on(event: string, listener: Function): this;
}
export class Events extends events.EventEmitter {
public on(event: "error", listener: (err: Error, client: Client) => void): Events;
public on(event: string, listener: Function): Events;
public on(event: "error", listener: (err: Error, client: Client) => void): this;
public on(event: string, listener: Function): this;
}
}
}
-5
View File
@@ -49,10 +49,5 @@ declare module 'png-async' {
write(data: any, cb?: any): boolean;
end(data?: any): void;
bitblt(dst: Image, sx: number, sy: number, w: number, h: number, dx: number, dy: number): Image;
on(event: string, listener: Function): Image;
once(event: string, listener: Function): Image;
removeListener(event: string, listener: Function): Image;
removeAllListeners(event: string): Image;
}
}
+6 -6
View File
@@ -22,7 +22,7 @@ declare module "pngjs2" {
colorType?: number;
inputHasAlpha?: boolean;
}
interface PNGMetadata {
width: number;
height: number;
@@ -40,10 +40,10 @@ declare module "pngjs2" {
data: Buffer;
gamma: number;
on(event: string, callback: Function): PNG;
on(event: "metadata", callback: (metadata: PNGMetadata) => void): PNG;
on(event: "parsed", callback: (data: Buffer) => void): PNG;
on(event: "error", callback: (err: Error) => void): PNG;
on(event: string, callback: Function): this;
on(event: "metadata", callback: (metadata: PNGMetadata) => void): this;
on(event: "parsed", callback: (data: Buffer) => void): this;
on(event: "error", callback: (err: Error) => void): this;
parse(data: string|Buffer, callback?: (err: Error, data: Buffer) => void): PNG;
pack(): PNG;
@@ -55,7 +55,7 @@ declare module "pngjs2" {
bitblt(dst: PNG, srcX: number, srcY: number,
width: number, height: number, deltaX: number, deltaY: number): PNG;
}
export namespace PNG {
namespace sync {
function read(buffer: string|Buffer, options?: PNGOptions): PNG;
+7 -7
View File
@@ -78,14 +78,14 @@ declare module 'pty.js' {
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
// NodeJS EventEmitter interface
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;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
// NOTE: this method is not actually defined in pty.js
setMaxListeners(n: number): NodeJS.EventEmitter;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
+7 -7
View File
@@ -62,7 +62,7 @@ declare module 'request' {
interface DefaultUriUrlRequestApi<TRequest extends Request,
TOptions extends CoreOptions,
TUriUrlOptions> extends RequestAPI<TRequest, TOptions, TUriUrlOptions> {
defaults(options: TOptions): DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>;
(): TRequest;
get(): TRequest;
@@ -182,12 +182,12 @@ declare module 'request' {
oauth(oauth: OAuthOptions): Request;
jar(jar: CookieJar): Request;
on(event: string, listener: Function): Request;
on(event: 'request', listener: (req: http.ClientRequest) => void): Request;
on(event: 'response', listener: (resp: http.IncomingMessage) => void): Request;
on(event: 'data', listener: (data: Buffer | string) => void): Request;
on(event: 'error', listener: (e: Error) => void): Request;
on(event: 'complete', listener: (resp: http.IncomingMessage, body?: string | Buffer) => void): Request;
on(event: string, listener: Function): this;
on(event: 'request', listener: (req: http.ClientRequest) => void): this;
on(event: 'response', listener: (resp: http.IncomingMessage) => void): this;
on(event: 'data', listener: (data: Buffer | string) => void): this;
on(event: 'error', listener: (e: Error) => void): this;
on(event: 'complete', listener: (resp: http.IncomingMessage, body?: string | Buffer) => void): this;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
+5 -5
View File
@@ -435,13 +435,13 @@ declare module SocketIO {
* @param listener A listener that should take one parameter of type Socket
* @return This Namespace
*/
on( event: 'connection', listener: ( socket: Socket ) => void ): Namespace;
on( event: 'connection', listener: ( socket: Socket ) => void ): this;
/**
* @see on( 'connection', listener )
*/
on( event: 'connect', listener: ( socket: Socket ) => void ): Namespace;
on( event: 'connect', listener: ( socket: Socket ) => void ): this;
/**
* Base 'on' method to add a listener for an event
* @param event The event that we want to add a listener for
@@ -449,7 +449,7 @@ declare module SocketIO {
* for the callback depend on the event
* @ This Namespace
*/
on( event: string, listener: Function ): Namespace;
on( event: string, listener: Function ): this;
/**
* Gets a list of clients.
+5 -5
View File
@@ -24,8 +24,8 @@ declare module "sockjs" {
export interface Server extends NodeJS.EventEmitter {
installHandlers(server: http.Server, options?: ServerOptions): any;
on(event: 'connection', listener: (conn: Connection) => any): Server;
on(event: string, listener: Function): Server;
on(event: 'connection', listener: (conn: Connection) => any): this;
on(event: string, listener: Function): this;
}
export interface Connection extends NodeJS.ReadWriteStream {
@@ -50,8 +50,8 @@ declare module "sockjs" {
close(code?: string, reason?: string): boolean;
destroy(): void;
on(event: 'data', listener: (message: string) => any): Connection;
on(event: 'close', listener: () => void): Connection;
on(event: string, listener: Function): Connection;
on(event: 'data', listener: (message: string) => any): this;
on(event: 'close', listener: () => void): this;
on(event: string, listener: Function): this;
}
}
+7 -7
View File
@@ -68,13 +68,13 @@ declare module "sqlite3" {
public serialize(callback?: () => void): void;
public parallelize(callback?: () => void): void;
public on(event: "trace", listener: (sql: string) => void): Database;
public on(event: "profile", listener: (sql: string, time: number) => void): Database;
public on(event: "error", listener: (err: Error) => void): Database;
public on(event: "open", listener: () => void): Database;
public on(event: "close", listener: () => void): Database;
public on(event: string, listener: Function): Database;
public on(event: "trace", listener: (sql: string) => void): this;
public on(event: "profile", listener: (sql: string, time: number) => void): this;
public on(event: "error", listener: (err: Error) => void): this;
public on(event: "open", listener: () => void): this;
public on(event: "close", listener: () => void): this;
public on(event: string, listener: Function): this;
}
function verbose(): void;
-7
View File
@@ -233,13 +233,6 @@ declare module "ssh2" {
exit(name: string, coreDumped: boolean, msg: string): boolean;
exit(status: number): boolean;
stderr?: ServerStderr;
// EventEmitter overrides
addListener(event: string, listener: Function): Channel;
on(event: string, listener: Function): Channel;
once(event: string, listener: Function): Channel;
removeListener(event: string, listener: Function): Channel;
removeAllListeners(event?: string): Channel;
}
interface ServerStderr extends NodeJS.WritableStream {
+6 -6
View File
@@ -47,12 +47,12 @@ declare module Steam {
setPersonaName(name: string): void;
// Event emitter
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): NodeJS.EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
+6 -6
View File
@@ -698,12 +698,12 @@ declare module Stylus {
import(file: string): Renderer;
//#region EventEmitter Members
addListener(event: string, listener: Function): Renderer;
on(event: string, listener: Function): Renderer;
once(event: string, listener: Function): Renderer;
removeListener(event: string, listener: Function): Renderer;
removeAllListeners(event?: string): Renderer;
setMaxListeners(n: number): Renderer;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
+42 -42
View File
@@ -151,14 +151,14 @@ declare module "websocket" {
shutDown(): void;
// Events
on(event: string, listener: () => void): server;
on(event: 'request', cb: (request: request) => void): server;
on(event: 'connect', cb: (connection: connection) => void): server;
on(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): server;
addListener(event: string, listener: () => void): server;
addListener(event: 'request', cb: (request: request) => void): server;
addListener(event: 'connect', cb: (connection: connection) => void): server;
addListener(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): server;
on(event: string, listener: () => void): this;
on(event: 'request', cb: (request: request) => void): this;
on(event: 'connect', cb: (connection: connection) => void): this;
on(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'request', cb: (request: request) => void): this;
addListener(event: 'connect', cb: (connection: connection) => void): this;
addListener(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): this;
}
export interface ICookie {
@@ -240,12 +240,12 @@ declare module "websocket" {
reject(httpStatus?: number, reason?: string): void;
// Events
on(event: string, listener: () => void): request;
on(event: 'requestAccepted', cb: (connection: connection) => void): request;
on(event: 'requestRejected', cb: () => void): request;
addListener(event: string, listener: () => void): request;
addListener(event: 'requestAccepted', cb: (connection: connection) => void): request;
addListener(event: 'requestRejected', cb: () => void): request;
on(event: string, listener: () => void): this;
on(event: 'requestAccepted', cb: (connection: connection) => void): this;
on(event: 'requestRejected', cb: () => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'requestAccepted', cb: (connection: connection) => void): this;
addListener(event: 'requestRejected', cb: () => void): this;
}
export interface IMessage {
@@ -288,12 +288,12 @@ declare module "websocket" {
take(encoding?: string): any;
// Events
on(event: string, listener: () => void): IBufferList;
on(event: 'advance', cb: (n: number) => void): IBufferList;
on(event: 'write', cb: (buf: Buffer) => void): IBufferList;
addListener(event: string, listener: () => void): IBufferList;
addListener(event: 'advance', cb: (n: number) => void): IBufferList;
addListener(event: 'write', cb: (buf: Buffer) => void): IBufferList;
on(event: string, listener: () => void): this;
on(event: 'advance', cb: (n: number) => void): this;
on(event: 'write', cb: (buf: Buffer) => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'advance', cb: (n: number) => void): this;
addListener(event: 'write', cb: (buf: Buffer) => void): this;
}
class connection extends events.EventEmitter {
@@ -430,16 +430,16 @@ declare module "websocket" {
sendFrame(frame: frame, cb?: (msg: string) => void): void;
// Events
on(event: string, listener: () => void): connection;
on(event: 'message', cb: (data: IMessage) => void): connection;
on(event: 'frame', cb: (frame: frame) => void): connection;
on(event: 'close', cb: (code: number, desc: string) => void): connection;
on(event: 'error', cb: (err: Error) => void): connection;
addListener(event: string, listener: () => void): connection;
addListener(event: 'message', cb: (data: IMessage) => void): connection;
addListener(event: 'frame', cb: (frame: frame) => void): connection;
addListener(event: 'close', cb: (code: number, desc: string) => void): connection;
addListener(event: 'error', cb: (err: Error) => void): connection;
on(event: string, listener: () => void): this;
on(event: 'message', cb: (data: IMessage) => void): this;
on(event: 'frame', cb: (frame: frame) => void): this;
on(event: 'close', cb: (code: number, desc: string) => void): this;
on(event: 'error', cb: (err: Error) => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'message', cb: (data: IMessage) => void): this;
addListener(event: 'frame', cb: (frame: frame) => void): this;
addListener(event: 'close', cb: (code: number, desc: string) => void): this;
addListener(event: 'error', cb: (err: Error) => void): this;
}
class frame {
@@ -559,12 +559,12 @@ declare module "websocket" {
connect(requestUrl: string, protocols?: string, origin?: string, headers?: any[]): void;
// Events
on(event: string, listener: () => void): client;
on(event: 'connect', cb: (connection: connection) => void): client;
on(event: 'connectFailed', cb: (err: Error) => void): client;
addListener(event: string, listener: () => void): client;
addListener(event: 'connect', cb: (connection: connection) => void): client;
addListener(event: 'connectFailed', cb: (err: Error) => void): client;
on(event: string, listener: () => void): this;
on(event: 'connect', cb: (connection: connection) => void): this;
on(event: 'connectFailed', cb: (err: Error) => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'connect', cb: (connection: connection) => void): this;
addListener(event: 'connectFailed', cb: (err: Error) => void): this;
}
class routerRequest extends events.EventEmitter {
@@ -616,12 +616,12 @@ declare module "websocket" {
reject(httpStatus?: number, reason?: string): void;
// Events
on(event: string, listener: () => void): request;
on(event: 'requestAccepted', cb: (connection: connection) => void): request;
on(event: 'requestRejected', cb: () => void): request;
addListener(event: string, listener: () => void): request;
addListener(event: 'requestAccepted', cb: (connection: connection) => void): request;
addListener(event: 'requestRejected', cb: () => void): request;
on(event: string, listener: () => void): this;
on(event: 'requestAccepted', cb: (connection: connection) => void): this;
on(event: 'requestRejected', cb: () => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'requestAccepted', cb: (connection: connection) => void): this;
addListener(event: 'requestRejected', cb: () => void): this;
}
interface IRouterConfig {
+16 -16
View File
@@ -28,8 +28,8 @@ declare module WebTorrent {
}
export interface Client extends NodeJS.EventEmitter, ClientConstructor {
on(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): this;
/**
* Start downloading a new torrent. Aliased as client.download.
@@ -50,16 +50,16 @@ declare module WebTorrent {
add(magnetUriOrPathOrInfoHash:string, opts?:TorrentOptions, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(torrentFileOrInfoHash:Buffer, opts?:TorrentOptions, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(parsedTorrent:ParseTorrent.ParsedTorrent, opts?:TorrentOptions, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(magnetUriOrPathOrInfoHash:string, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(torrentFileOrInfoHash:Buffer, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(parsedTorrent:ParseTorrent.ParsedTorrent, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
/**
* Emitted when a torrent is ready to be used (i.e. metadata is available and store is ready). See the torrent section for more info on what methods a torrent has.
*/
on(event:'torrent', callback:(torrent:Torrent)=>void): NodeJS.EventEmitter;
on(event:'torrent', callback:(torrent:Torrent)=>void): this;
/**
* Start seeding a new torrent.
@@ -117,8 +117,8 @@ declare module WebTorrent {
}
export interface Torrent extends NodeJS.EventEmitter {
on(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): this;
/**
* Get the info hash of the torrent.
*/
@@ -228,22 +228,22 @@ declare module WebTorrent {
/**
* Emitted when all the torrent's files have been downloaded.
*/
on(event: 'done', callback:()=>void): NodeJS.EventEmitter;
on(event: 'done', callback:()=>void): this;
/**
* Emitted every time a new chunk of data arrives, it's useful for reporting the current torrent status.
*/
on(event: 'download', callback:(chunkSize:number)=>void): NodeJS.EventEmitter;
on(event: 'download', callback:(chunkSize:number)=>void): this;
/**
* Emitted whenever a new peer is connected for this torrent. wire is an instance of bittorrent-protocol, which is a node.js-style duplex stream to the remote peer. This event can be used to specify custom BitTorrent protocol extensions.
*/
on(event: 'wire', callback:(wire:any)=>void): NodeJS.EventEmitter;
on(event: 'wire', callback:(wire:any)=>void): this;
}
export interface InTorrentFile extends NodeJS.EventEmitter {
on(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): this;
/**
* File name, as specified by the torrent. Example: 'some-filename.txt'
*/
@@ -330,7 +330,7 @@ declare module WebTorrent {
/**
* Emitted when the file have been downloaded.
*/
on(event: 'done', callback:()=>void): NodeJS.EventEmitter;
on(event: 'done', callback:()=>void): this;
}
}
Vendored
+22 -22
View File
@@ -69,21 +69,21 @@ declare module "ws" {
addEventListener(method: string, listener?: () => void): void;
// Events
on(event: 'error', cb: (err: Error) => void): WebSocket;
on(event: 'close', cb: (code: number, message: string) => void): WebSocket;
on(event: 'message', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
on(event: 'ping', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
on(event: 'pong', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
on(event: 'open', cb: () => void): WebSocket;
on(event: string, listener: () => void): WebSocket;
on(event: 'error', cb: (err: Error) => void): this;
on(event: 'close', cb: (code: number, message: string) => void): this;
on(event: 'message', cb: (data: any, flags: {binary: boolean}) => void): this;
on(event: 'ping', cb: (data: any, flags: {binary: boolean}) => void): this;
on(event: 'pong', cb: (data: any, flags: {binary: boolean}) => void): this;
on(event: 'open', cb: () => void): this;
on(event: string, listener: () => void): this;
addListener(event: 'error', cb: (err: Error) => void): WebSocket;
addListener(event: 'close', cb: (code: number, message: string) => void): WebSocket;
addListener(event: 'message', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
addListener(event: 'ping', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
addListener(event: 'pong', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
addListener(event: 'open', cb: () => void): WebSocket;
addListener(event: string, listener: () => void): WebSocket;
addListener(event: 'error', cb: (err: Error) => void): this;
addListener(event: 'close', cb: (code: number, message: string) => void): this;
addListener(event: 'message', cb: (data: any, flags: {binary: boolean}) => void): this;
addListener(event: 'ping', cb: (data: any, flags: {binary: boolean}) => void): this;
addListener(event: 'pong', cb: (data: any, flags: {binary: boolean}) => void): this;
addListener(event: 'open', cb: () => void): this;
addListener(event: string, listener: () => void): this;
}
module WebSocket {
@@ -115,15 +115,15 @@ declare module "ws" {
upgradeHead: Buffer, callback: (client: WebSocket) => void): void;
// Events
on(event: 'error', cb: (err: Error) => void): Server;
on(event: 'headers', cb: (headers: string[]) => void): Server;
on(event: 'connection', cb: (client: WebSocket) => void): Server;
on(event: string, listener: () => void): Server;
on(event: 'error', cb: (err: Error) => void): this;
on(event: 'headers', cb: (headers: string[]) => void): this;
on(event: 'connection', cb: (client: WebSocket) => void): this;
on(event: string, listener: () => void): this;
addListener(event: 'error', cb: (err: Error) => void): Server;
addListener(event: 'headers', cb: (headers: string[]) => void): Server;
addListener(event: 'connection', cb: (client: WebSocket) => void): Server;
addListener(event: string, listener: () => void): Server;
addListener(event: 'error', cb: (err: Error) => void): this;
addListener(event: 'headers', cb: (headers: string[]) => void): this;
addListener(event: 'connection', cb: (client: WebSocket) => void): this;
addListener(event: string, listener: () => void): this;
}
export function createServer(options?: IServerOptions,
+6 -6
View File
@@ -46,12 +46,12 @@ declare module yo {
runHooks(callback?: Function): void;
sourceRoot(rootPath?: string): string;
templatePath(...path: 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): NodeJS.EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;