Merge branch 'i2' into qa

This commit is contained in:
Barbara Miller 2016-11-11 13:34:44 -08:00
commit 7093e66360

View file

@ -37,7 +37,7 @@ var umbraInstagramBehavior = {
return; return;
} }
if (this.idleSince == null) { if (this.idleSince === null) {
console.log("nothing to do at the moment, might be waiting for something to load, setting this.idleSince=Date.now()"); console.log("nothing to do at the moment, might be waiting for something to load, setting this.idleSince=Date.now()");
this.idleSince = Date.now(); this.idleSince = Date.now();
return; return;
@ -46,11 +46,8 @@ var umbraInstagramBehavior = {
console.log("finished loading-thumbs, it appears we have reached the bottom"); console.log("finished loading-thumbs, it appears we have reached the bottom");
this.state = "clicking-first-thumb"; this.state = "clicking-first-thumb";
this.idleSince = null; this.idleSince = null;
return;
} else {
// console.log("still might be waiting for something to load...");
return;
} }
return;
} }
} }
@ -93,11 +90,11 @@ var umbraInstagramBehavior = {
start: function() { start: function() {
var that = this; var that = this;
this.intervalId = setInterval(function(){ that.intervalFunc() }, 300); this.intervalId = setInterval(function(){ that.intervalFunc(); }, 300);
}, },
isFinished: function() { isFinished: function() {
if (this.idleSince != null) { if (this.idleSince !== null) {
var idleTimeMs = Date.now() - this.idleSince; var idleTimeMs = Date.now() - this.idleSince;
if (idleTimeMs / 1000 > this.IDLE_TIMEOUT_SEC) { if (idleTimeMs / 1000 > this.IDLE_TIMEOUT_SEC) {
clearInterval(this.intervalId); clearInterval(this.intervalId);
@ -105,10 +102,10 @@ var umbraInstagramBehavior = {
} }
} }
return false; return false;
}, }
}; };
// Called from outside of this script. // Called from outside of this script.
var umbraBehaviorFinished = function() { return umbraInstagramBehavior.isFinished() }; var umbraBehaviorFinished = function() { return umbraInstagramBehavior.isFinished(); };
umbraInstagramBehavior.start(); umbraInstagramBehavior.start();