kopia lustrzana https://github.com/shoelace-style/shoelace
add parseDuration method
rodzic
8776c3f4a8
commit
3fce846a8d
|
@ -18,6 +18,23 @@ export function animateTo(el: HTMLElement, keyframes: Keyframe[], options?: Keyf
|
|||
});
|
||||
}
|
||||
|
||||
//
|
||||
// Parses a CSS duration and returns the number of milliseconds.
|
||||
//
|
||||
export function parseDuration(delay: number | string) {
|
||||
delay = (delay + '').toLowerCase();
|
||||
|
||||
if (delay.indexOf('ms') > -1) {
|
||||
return parseFloat(delay);
|
||||
}
|
||||
|
||||
if (delay.indexOf('s') > -1) {
|
||||
return parseFloat(delay) * 1000;
|
||||
}
|
||||
|
||||
return parseFloat(delay);
|
||||
}
|
||||
|
||||
//
|
||||
// Tells if the user has enabled the "reduced motion" setting in their browser or OS.
|
||||
//
|
||||
|
|
Ładowanie…
Reference in New Issue