Allow calls to fromNode without a result parameter in the callback

This commit is contained in:
Eric Nicholson
2015-11-10 20:21:43 -05:00
parent 421d6610bd
commit 6824b8c8e6
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -150,6 +150,7 @@ var BlueBird: typeof Promise;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var nodeCallbackFunc = (callback: (err: any, result: string) => void) => {}
var nodeCallbackFuncErrorOnly = (callback: (err: any) => void) => {}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -678,6 +679,7 @@ func = Promise.promisify(f, obj);
obj = Promise.promisifyAll(obj);
anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback));
anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback));
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+1 -1
View File
@@ -426,7 +426,7 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
/**
* Returns a promise that is resolved by a node style callback function.
*/
static fromNode(resolver: (callback: (err: any, result: any) => void) => void): Promise<any>;
static fromNode(resolver: (callback: (err: any, result?: any) => void) => void): Promise<any>;
/**
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.