Skip to content

Commit

Permalink
Provide thisArg when calling apply. Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
tfoxy committed Jun 15, 2015
1 parent 2151365 commit 935ef84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions chrome-promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
chrome = chrome || root.chrome;
Promise = Promise || root.Promise;

var setPromiseFunction = function(val) {
var setPromiseFunction = function(fn, self) {

return function() {
var args = arguments;
Expand All @@ -44,7 +44,7 @@
args[args.length] = callback;
args.length++;

val.apply(null, args);
fn.apply(self, args);
});

};
Expand All @@ -62,7 +62,7 @@
fillProperties(val, to[key]);
}
else if (type === 'function') {
to[key] = setPromiseFunction(val);
to[key] = setPromiseFunction(val, from);
}
else {
to[key] = val;
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": "chrome-promise",
"version": "1.0.1",
"version": "1.0.2",
"description": "Promises for chrome JavaScript APIs which is used in extensions and apps.",
"main": "./index",
"scripts": {
Expand Down

0 comments on commit 935ef84

Please sign in to comment.