Skip to content

Instantly share code, notes, and snippets.

@fedyk
Created July 19, 2019 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedyk/3a045661e38a09b0d259e364ff09e28e to your computer and use it in GitHub Desktop.
Save fedyk/3a045661e38a09b0d259e364ff09e28e to your computer and use it in GitHub Desktop.
Script allows you to test freeze in web application
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