mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
b4d95f7e20
for better perfermance
21 lines
587 B
TypeScript
21 lines
587 B
TypeScript
import TransitionEvents from 'css-animation/lib/Event';
|
|
|
|
const clickAnimation = (node: HTMLElement) => {
|
|
function handler() {
|
|
node.removeAttribute('ant-click-animating');
|
|
node.setAttribute('ant-click-animating', 'true');
|
|
TransitionEvents.addEndEventListener(node, () => {
|
|
node.removeAttribute('ant-click-animating');
|
|
TransitionEvents.removeEndEventListener(node);
|
|
});
|
|
}
|
|
node.addEventListener('click', handler, false);
|
|
return {
|
|
cancel: () => {
|
|
node.removeEventListener('click', handler, false);
|
|
},
|
|
};
|
|
};
|
|
|
|
export default clickAnimation;
|