aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.mjs')
-rw-r--r--src/utils.mjs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils.mjs b/src/utils.mjs
index ad9131e..3824672 100644
--- a/src/utils.mjs
+++ b/src/utils.mjs
@@ -6,7 +6,7 @@
6 */ 6 */
7export const onRemove = (element, callback) => { 7export const onRemove = (element, callback) => {
8 const parent = element.parentNode; 8 const parent = element.parentNode;
9 if (!parent) throw new Error("The node must already be attached"); 9 if (!parent) throw new Error('The node must already be attached');
10 10
11 const obs = new MutationObserver(mutations => { 11 const obs = new MutationObserver(mutations => {
12 for (const mutation of mutations) { 12 for (const mutation of mutations) {
@@ -33,7 +33,7 @@ export const onRemove = (element, callback) => {
33 */ 33 */
34export const animateRectTransition = (element, rect, options = {}) => { 34export const animateRectTransition = (element, rect, options = {}) => {
35 if (!element.parentElement) 35 if (!element.parentElement)
36 throw new Error("The node must already be attached"); 36 throw new Error('The node must already be attached');
37 37
38 const { width: w1, height: h1, left: x1, top: y1 } = rect; 38 const { width: w1, height: h1, left: x1, top: y1 } = rect;
39 const { 39 const {
@@ -62,7 +62,7 @@ export const animateRectTransition = (element, rect, options = {}) => {
62 62
63 return element.animate(keyframes, { 63 return element.animate(keyframes, {
64 duration: options.duration ?? 500, 64 duration: options.duration ?? 500,
65 easing: "ease-in-out", 65 easing: 'ease-in-out',
66 }); 66 });
67}; 67};
68 68
@@ -82,7 +82,7 @@ export function throttle(func, delay) {
82 82
83 timerFlag = setTimeout( 83 timerFlag = setTimeout(
84 () => (timerFlag = null), 84 () => (timerFlag = null),
85 typeof delay === "function" ? delay.call(context) : delay, 85 typeof delay === 'function' ? delay.call(context) : delay,
86 ); 86 );
87 87
88 return func.call(context, ...args); 88 return func.call(context, ...args);