Pro TypeScript by Steve Fenton

Pro TypeScript by Steve Fenton

Author:Steve Fenton
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


test();

Listing 5-1. Queued timer

To simulate a long-running process, a loop that runs for 100 ms has been added to the test function in Listing 5-2. The loop starts after the timer is set up, but because nothing is de-queued until the original test function is completed, the timer executes much later than before. The times logged in this example are typically in the range of 118 to 130 ms.

function test() {

const testStart = performance.now();

window.setTimeout(function () {

console.log(performance.now() - testStart);

}, 50);



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.