Last active
August 4, 2017 18:46
-
-
Save magjac/1146ec566345eea83732425f11570bc8 to your computer and use it in GitHub Desktop.
D3 timer bug (?) 3
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<h1>Open the console and look for messages</h1> | |
<script src="//d3js.org/d3.v4.min.js"></script> | |
<script> | |
var n = 30000000; | |
console.time('delay1'); | |
d3.transition() | |
.delay(500) | |
.duration(1000) | |
.on("start", function() { | |
console.timeEnd('delay1'); | |
console.time('duration1'); | |
}) | |
.on("end", function() { | |
console.timeEnd('duration1'); | |
console.time('delay2'); | |
console.time('work'); | |
for (i = 0; i < n; i++) | |
; | |
console.timeEnd('work'); | |
}) | |
.transition() | |
.delay(500) | |
.duration(1000) | |
.on("start", function() { | |
console.timeEnd('delay2'); | |
console.time('duration2'); | |
}) | |
.on("end", function() { | |
console.timeEnd('duration2'); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment