Skip to content

Commit

Permalink
Refactored variable;
Browse files Browse the repository at this point in the history
  • Loading branch information
DigitalBrainJS committed May 28, 2020
1 parent 6d70a11 commit bcbb5d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/eventemitter2.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
var isCancelable;
var callbacks;
var timer= 0;
var subscribeClosed;
var subscriptionClosed;

var promise = new Promise(function (resolve, reject, onCancel) {
options= resolveOptions(options, {
Expand Down Expand Up @@ -383,15 +383,15 @@
_reject(reason || Error('canceled'));
}];
executor(_resolve, _reject, function (cb) {
if (subscribeClosed) {
if (subscriptionClosed) {
throw Error('Unable to subscribe on cancel event asynchronously')
}
if (typeof cb !== 'function') {
throw TypeError('onCancel callback must be a function');
}
callbacks.push(cb);
});
subscribeClosed= true;
subscriptionClosed= true;
}

if (options.timeout > 0) {
Expand Down

0 comments on commit bcbb5d3

Please sign in to comment.