Skip to content

Commit

Permalink
Add transition.end. Fixes #77.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Feb 28, 2018
1 parent bcc3975 commit aa95e77
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .eslintrc
@@ -1,6 +1,9 @@
parserOptions:
sourceType: module

env:
es6: true

extends:
"eslint:recommended"

Expand Down
9 changes: 9 additions & 0 deletions src/transition/end.js
@@ -0,0 +1,9 @@
// TODO Anonymous names for event listeners.
export default function() {
var that = this, size = that.size();
return new Promise(function(resolve, reject) {
that.on("cancel.end interrupt.end", reject).on("end.end", function() {
if (--size === 0) resolve();
});
});
}
4 changes: 3 additions & 1 deletion src/transition/index.js
Expand Up @@ -16,6 +16,7 @@ import transition_styleTween from "./styleTween";
import transition_text from "./text";
import transition_transition from "./transition";
import transition_tween from "./tween";
import transition_end from "./end";

var id = 0;

Expand Down Expand Up @@ -60,5 +61,6 @@ Transition.prototype = transition.prototype = {
tween: transition_tween,
delay: transition_delay,
duration: transition_duration,
ease: transition_ease
ease: transition_ease,
end: transition_end
};

0 comments on commit aa95e77

Please sign in to comment.