Skip to content

Commit

Permalink
global pause is working now
Browse files Browse the repository at this point in the history
  • Loading branch information
julio-saito-linx committed Sep 20, 2014
1 parent dcdd799 commit 37c571e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/reporter.js
Expand Up @@ -57,7 +57,12 @@ Reporter.prototype.onCall = function(info) {
// Pause
if(this.showPause){
// cancel last setTimeout because is processing
clearTimeout(this.globalTimeoutLogId);
if(typeof window !== 'undefined'){
clearTimeout(window.globalTimeoutLogId);
}else{
clearTimeout(this.globalTimeoutLogId);
}

// if not canceled, it shows the line bellow

setParentTimeout(this.logger, this.waitForPause, this.pauseCallBack);
Expand Down Expand Up @@ -183,15 +188,26 @@ Reporter.prototype._renderToConsole = function(info, mainMessage) {
}
};

this.globalTimeoutLogId = null;
if(typeof window !== 'undefined'){
window.globalTimeoutLogId = null;
}
else{
this.globalTimeoutLogId = null;
}

var setParentTimeout = function(logger, wait, pauseCallBack) {
this.globalTimeoutLogId = setTimeout(function (){
var globalTimeoutLogId = setTimeout(function (){
logger.log('----------------------------------pause--------------------------');
if(pauseCallBack){
pauseCallBack();
}
}.bind(this), wait);

if(typeof window !== 'undefined'){
window.globalTimeoutLogId = globalTimeoutLogId;
}else{
this.globalTimeoutLogId = globalTimeoutLogId;
}
};

module.exports = Reporter;

0 comments on commit 37c571e

Please sign in to comment.