forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor button click effect implementation
for better perfermance
- Loading branch information
Showing
5 changed files
with
53 additions
and
35 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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; |
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
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
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