Created
July 19, 2019 14:37
-
-
Save fedyk/3a045661e38a09b0d259e364ff09e28e to your computer and use it in GitHub Desktop.
Script allows you to test freeze in web application
This file contains hidden or 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
function freezeApp(duration) { | |
var now = new Date().getTime(); | |
var endTime = now + duration; | |
console.log('start freeze time', new Date().toISOString(), 'window is focused:', document.hasFocus()); | |
while(new Date().getTime() < endTime) document.querySelector('this.is > [very] > *[heavy] > .css[selector]'); | |
console.log('end freeze time', new Date().toISOString(), 'window is focused:', document.hasFocus()); | |
} | |
/** | |
* Freeze app for 5000ms with 2000ms delay | |
*/ | |
setTimeout(() => freezeApp(5000), 2000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment