diff --git a/.eslintrc b/.eslintrc index d1da9f4..35c67db 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,9 @@ parserOptions: sourceType: module +env: + es6: true + extends: "eslint:recommended" diff --git a/src/transition/end.js b/src/transition/end.js new file mode 100644 index 0000000..55204d0 --- /dev/null +++ b/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(); + }); + }); +} diff --git a/src/transition/index.js b/src/transition/index.js index b479b9f..ffb49ea 100644 --- a/src/transition/index.js +++ b/src/transition/index.js @@ -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; @@ -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 };