remove event listeners in destroy, add once method

This commit is contained in:
cky
2018-06-12 20:55:31 +08:00
parent 0b09b8ee6f
commit 87170ab460
8 changed files with 73 additions and 53 deletions

4
src/js/controls.js vendored
View File

@ -1063,12 +1063,10 @@ const controls = {
container.style.width = '';
container.style.height = '';
// Only listen once
utils.off(container, utils.transitionEndEvent, restore);
};
// Listen for the transition finishing and restore auto height/width
utils.on(container, utils.transitionEndEvent, restore);
utils.once(container, utils.transitionEndEvent, restore);
// Set dimensions to target
container.style.width = `${size.width}px`;