Skip to content

Commit

Permalink
Replace deferred.node with makeNodeResolver
Browse files Browse the repository at this point in the history
Per @rauschma's sound advice.

Fixes kriskowal#55.
  • Loading branch information
kriskowal committed Apr 29, 2012
1 parent 663febc commit 2fb9fa4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
removed. Use ``sender(op)``.
- WARNING: The deprecated ``node`` export will be removed.
Use ``nbind``.
- WARNING: The deprecated ``deferred.node()`` interface will be
removed. Use ``deferred.makeNodeResolver()``.

## Next minor

Expand All @@ -15,6 +17,8 @@
backward-incompatibility since it is a change of an undocumented and
unspecified public behavior, but if you happened to depend on the
exception being a string, you will need to revise your code.
- Added ``deferred.makeNodeResolver()`` to replace the more cryptic
``deferred.node()`` method.

## 0.8.3

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,12 @@ return Q.call(function () {

### Adapting Node

There is a ``node`` method on deferreds that is handy for the NodeJS
callback pattern.
There is a ``makeNodeResolver`` method on deferreds that is handy for
the NodeJS callback pattern.

```javascript
var deferred = Q.defer();
FS.readFile("foo.txt", "utf-8", deferred.node());
FS.readFile("foo.txt", "utf-8", deferred.makeNodeResolver());
return deferred.promise;
```

Expand Down
3 changes: 2 additions & 1 deletion q.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ function defer() {
return deferred;
}

defer.prototype.node = function () {
defer.prototype.node = // XXX deprecated
defer.prototype.makeNodeResolver = function () {
var self = this;
return function (error, value) {
if (error) {
Expand Down

0 comments on commit 2fb9fa4

Please sign in to comment.