Skip to content

Commit

Permalink
## ver 1.0.1 (2016-10-8)
Browse files Browse the repository at this point in the history
add:

1. bind this to then callback
  • Loading branch information
itestauipi committed Oct 8, 2016
1 parent a889ccb commit c5f0de1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
PromiseClass change log
====================

## ver 1.0.1 (2016-10-8)

add:

1. bind this to then callback

## ver 1.0.0 (2016-9-30)

add:
Expand Down
6 changes: 6 additions & 0 deletions lib/promiseclass.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ const PromiseClass = {
return co(rawOnResolve.apply(self, arguments));
};
}
else if(onResolve){
onResolve = onResolve.bind(self);
}
if(isGeneratorFunction(onReject)){
let rawOnReject = onReject;
onReject = function(){
return co(rawOnReject.apply(self, arguments));
};
}
else if(onReject){
onReject = onReject.bind(self);
}
let promise = rawThen.call(self, onResolve, onReject);
promise._context = self._context;
return promise;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "promiseclass",
"version": "1.0.0",
"version": "1.0.1",
"description": "Create Promise chain Class",
"main": "./index",
"dependencies": {
Expand Down

0 comments on commit c5f0de1

Please sign in to comment.