Last active
August 27, 2019 09:23
-
-
Save miguelmota/3faa2a2954f5249f61d9 to your computer and use it in GitHub Desktop.
D3 callback when all transitions are done
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
function endAll(transition, callback) { | |
var n = 0 | |
transition.each(() => ++n) | |
.each('end', () => (!--n && callback.apply(this, arguments))) | |
} | |
// Usage | |
// d3.selectAll('g').transition().call(endAll, allDone) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@phocks you literally saved my life