Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Size optimization in timeout.js

  • Loading branch information...
commit 120e227c9d8d6e3a05d3b5aaf8a4e200aa8207a0 1 parent ae714cc
@briancavalier briancavalier authored
Showing with 11 additions and 11 deletions.
  1. +11 −11 timeout.js
View
22 timeout.js
@@ -46,18 +46,18 @@ define(['./when'], function(when) {
timeout = undef;
}
- when(promise, deferred.resolve, deferred.reject);
+ when(promise,
+ function(value) {
+ cancelTimeout();
+ return deferred.resolve(value);
+ },
+ function(reason) {
+ cancelTimeout();
+ return deferred.reject(reason);
+ }
+ );
- return deferred.then(
- function(value) {
- cancelTimeout();
- return value;
- },
- function(reason) {
- cancelTimeout();
- throw reason;
- }
- );
+ return deferred.promise;
};
});
Please sign in to comment.
Something went wrong with that request. Please try again.