mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #5388 from Necroskillz/bluebird_fromNode
Add fromNode to bluebird
This commit is contained in:
@@ -144,6 +144,10 @@ var BlueBird: typeof Promise;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var nodeCallbackFunc = (callback: (err: any, result: string) => void) => {}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooThen = fooProm;
|
||||
barThen = barProm;
|
||||
|
||||
@@ -616,6 +620,7 @@ func = Promise.promisify(f, obj);
|
||||
;
|
||||
|
||||
obj = Promise.promisifyAll(obj);
|
||||
anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback));
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
Vendored
+6
@@ -417,6 +417,12 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
// TODO how to model promisifyAll?
|
||||
static promisifyAll(target: Object, options?: Object): Object;
|
||||
|
||||
|
||||
/**
|
||||
* Returns a promise that is resolved by a node style callback function.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user