Skip to content

Commit 7c3a246

Browse files
committed
feat: jsCssAnimations.toggle() now accepts 'start' and 'complete' callbacks option
1 parent bf32811 commit 7c3a246

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

js-css-animations/animate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ const updateCssProperties = (element, opts) => {
118118
if (typeof opts[prop] === 'number') {
119119
const unit = {
120120
duration: 'ms',
121+
delay: 'ms',
121122
angle: 'deg',
122123
blur: 'px',
123124
iteration: '',
124125
};
125-
unit.delay = unit.duration;
126126

127127
opts[prop] = `${opts[prop]}` + unit[prop];
128128
}

js-css-animations/js-css-animations.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ const getTargets = selector => {
7474
* dimensionsTransition: boolean|undefined,
7575
* widthTransition: boolean|undefined,
7676
* heightTransition: boolean|undefined
77-
* }} opts - All options that can be passed by the user to customize the animation
77+
* }|{}} opts - All options that can be passed by the user to customize the animation
7878
*/
79-
// @ts-ignore
8079
const toggle = (selector, animA, animB, opts = {}) => {
8180
const args = {};
8281
[
@@ -93,6 +92,8 @@ const toggle = (selector, animA, animB, opts = {}) => {
9392
'dimensionsTransition',
9493
'widthTransition',
9594
'heightTransition',
95+
'start',
96+
'complete',
9697
].forEach(prop => (args[prop] = opts[prop]));
9798

9899
/**

0 commit comments

Comments
 (0)