Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/petkaantonov/bluebird
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamingr committed Aug 29, 2016
2 parents d571cc9 + 3cc912f commit 6f4d855
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docs/api/promise.props.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function directorySizeInfo(root) {
return stat;
});
}).then(_.flatten);
})(root).then(_);
})(root).then(_.chain);

var smallest = stats.call("min", "size").call("pick", "size", "filePath").call("value");
var largest = stats.call("max", "size").call("pick", "size", "filePath").call("value");
Expand Down Expand Up @@ -105,4 +105,4 @@ Promise.join(getPictures(), getComments(), getTweets(),
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
21 changes: 21 additions & 0 deletions docs/docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,27 @@ window.onpromisechained = function(promise, child) {

##Cancellation and timeouts

See [`Cancellation`](.) for how to use cancellation.

```js
// Enable cancellation
Promise.config({cancellation: true});

var fs = Promise.promisifyAll(require("fs"));

// In 2000ms or less, load & parse a file 'config.json'
var p = Promise.resolve('./config.json')
.timeout(2000)
.catch(console.error.bind(console, 'Failed to load config!'))
.then(fs.readFileAsync)
.then(JSON.parse);
// Listen for exception event to trigger promise cancellation
process.on('unhandledException', function(event) {
// cancel config loading
p.cancel();
});
```

##Scoped prototypes

Building a library that depends on bluebird? You should know about the "scoped prototype" feature.
Expand Down

0 comments on commit 6f4d855

Please sign in to comment.