Created
March 2, 2012 16:44
-
-
Save mark-rushakoff/1959568 to your computer and use it in GitHub Desktop.
Make jasmine run at full speed when in a background tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var foregroundScreenRefreshRate = 1500; | |
var backgroundScreenRefreshRate = 9000; | |
jasmine.getEnv().updateInterval = foregroundScreenRefreshRate; | |
$(window).focus(function() { | |
jasmine.getEnv().updateInterval = foregroundScreenRefreshRate; | |
}); | |
$(window).blur(function() { | |
jasmine.getEnv().updateInterval = backgroundScreenRefreshRate; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.