mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Q: adding inspect() method, changing return type of getSettled
As per documentation: https://github.com/kriskowal/q/wiki/API-Reference#promiseallsettled https://github.com/kriskowal/q/wiki/API-Reference#promiseinspect
This commit is contained in:
+16
-1
@@ -90,4 +90,19 @@ Q.all<number>(myNums).then(nums => nums.map(Math.round));
|
||||
Q.fbind((dateString) => new Date(dateString), "11/11/1991")().then(d => d.toLocaleDateString());
|
||||
|
||||
Q.when(8, num => num + "!");
|
||||
Q.when(Q(8), num => num + "!").then(str => str.split(','));
|
||||
Q.when(Q(8), num => num + "!").then(str => str.split(','));
|
||||
|
||||
declare function saveToDisk(): Q.Promise<any>;
|
||||
declare function saveToCloud(): Q.Promise<any>;
|
||||
Q.allSettled([saveToDisk(), saveToCloud()]).spread(function (disk, cloud) {
|
||||
console.log("saved to disk:", disk.state === "fulfilled");
|
||||
console.log("saved to cloud:", cloud.state === "fulfilled");
|
||||
|
||||
if (disk.state === "fulfilled") {
|
||||
console.log("value was " + disk.value);
|
||||
}
|
||||
else if (disk.state === "rejected") {
|
||||
console.log("rejected because " + disk.reason);
|
||||
}
|
||||
}).done();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user