Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Make jasmine run at full speed when in a background tab

View gist:1959568
1 2 3 4 5 6 7 8 9 10 11 12
var foregroundScreenRefreshRate = 1500;
var backgroundScreenRefreshRate = 9000;
 
jasmine.getEnv().updateInterval = foregroundScreenRefreshRate;
 
$(window).focus(function() {
jasmine.getEnv().updateInterval = foregroundScreenRefreshRate;
});
 
$(window).blur(function() {
jasmine.getEnv().updateInterval = backgroundScreenRefreshRate;
});
Owner

Deleting the update interval actually caused the blur/focus event to never get called until specs were over. Oops!

A background timeout of 9000 was arbtitrarily chosen because the default max script limit in Firefox is 10 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.