From db28808cdd015a29d4c8bc5020c14e9304b46a65 Mon Sep 17 00:00:00 2001 From: Matt Magurany Date: Fri, 4 Sep 2015 17:22:24 -0400 Subject: [PATCH] Add oboe node() function overload that accepts a map of callbacks. --- oboe/oboe.d.ts | 116 +++++++++++++++++++++++++------------------------ 1 file changed, 59 insertions(+), 57 deletions(-) diff --git a/oboe/oboe.d.ts b/oboe/oboe.d.ts index 63d51796b..b3bbb8d0c 100644 --- a/oboe/oboe.d.ts +++ b/oboe/oboe.d.ts @@ -5,64 +5,66 @@ /// -declare module "oboe" { - import stream = require('stream'); - - function oboe(url: string): oboe.Oboe; - function oboe(options: oboe.Options): oboe.Oboe; - function oboe(stream: stream.Readable): oboe.Oboe; - - module oboe { - var drop: {}; - - interface Oboe { - done(callback: (result: any) => void): Oboe; - - fail(callback: (result: FailReason) => void): Oboe; - - node(pattern: string, callback: CallbackSignature): Oboe; - node(patterns: PatternMap): Oboe; - - on(event: string, pattern: string, callback: CallbackSignature): Oboe; - on(eventPattern: string, callback: CallbackSignature): Oboe; - - path(pattern: string, callback: CallbackSignature): Oboe; - path(listeners: any): Oboe; - - removeListener(eventPattern: string, callback: CallbackSignature): Oboe; - removeListener(event: string, pattern: string, callback: CallbackSignature): Oboe; - - start(callback: (status: number, headers: Object) => void): Oboe; - - abort():void; - - source: string; - } - - interface CallbackSignature { - (node: any, pathOrHeaders: any, ancestors: Object[]): any; - } - - interface Options { - url: string; - method?: string; - headers?: Object; - body?: any; - cached?: boolean; - withCredentials?: boolean; - } - - interface FailReason { - thrown?: Error; - statusCode?: number; - body?: string; - jsonBody?: Object; - } - - interface PatternMap { - [pattern: string]: CallbackSignature - } +declare module oboe { + interface OboeFunction extends Function { + drop: Object; + (url: string): oboe.Oboe; + (options: oboe.Options): oboe.Oboe; + (stream: NodeJS.ReadableStream): oboe.Oboe; } + interface Oboe { + done(callback: (result: any) => void): Oboe; + + fail(callback: (result: FailReason) => void): Oboe; + + node(pattern: string, callback: CallbackSignature): Oboe; + node(patterns: PatternMap): Oboe; + + on(event: string, pattern: string, callback: CallbackSignature): Oboe; + on(eventPattern: string, callback: CallbackSignature): Oboe; + + path(pattern: string, callback: CallbackSignature): Oboe; + path(listeners: any): Oboe; + + removeListener(eventPattern: string, callback: CallbackSignature): Oboe; + removeListener(event: string, pattern: string, callback: CallbackSignature): Oboe; + + start(callback: (status: number, headers: Object) => void): Oboe; + + abort():void; + + source: string; + } + + interface CallbackSignature { + (node: any, pathOrHeaders: any, ancestors: Object[]): any; + } + + interface Options { + url: string; + method?: string; + headers?: Object; + body?: any; + cached?: boolean; + withCredentials?: boolean; + } + + interface FailReason { + thrown?: Error; + statusCode?: number; + body?: string; + jsonBody?: Object; + } + + interface PatternMap { + [pattern: string]: CallbackSignature + } +} + +declare var oboe: oboe.OboeFunction; + +declare module "oboe" { + var oboe: oboe.OboeFunction; export = oboe; }