From c242c3a7af369c6499e118071d70a2c0f1de6ba7 Mon Sep 17 00:00:00 2001 From: Lorik <56921718+lorikku@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:12:30 +0200 Subject: [PATCH] Renamed start/stop holyProgress to holyLoader Co-authored-by: Tom Rumpf <35841182+tomcru@users.noreply.github.com> --- README.md | 8 ++++---- src/index.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d6fa5dc..65ac829 100644 --- a/README.md +++ b/README.md @@ -92,16 +92,16 @@ Have an async operation before an eventual route change? You might be interested ```typescript 'use client'; -import { startHolyProgress, stopHolyProgress } from 'holy-loader'; +import { startHolyLoader, stopHolyLoader } from 'holy-loader'; try { - startHolyProgress(); // Trigger the loader beforehand + startHolyLoader(); // Trigger the loader beforehand await signOut(); // Example async operation } catch (error) { - stopHolyProgress(); // Stop the loader on error + stopHolyLoader(); // Stop the loader on error // Handle the error } finally { - stopHolyProgress(); // Stop the loader after the operation, and potentially do something else + stopHolyLoader(); // Stop the loader after the operation, and potentially do something else /* OR */ router.push('/'); // Navigate to the desired route, which will automatically stop the loader } diff --git a/src/index.tsx b/src/index.tsx index 05b43ba..90c21f3 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -100,14 +100,14 @@ export const isSameHost = (currentUrl: string, newUrl: string): boolean => { /** * Dispatches the event to manually start the HolyLoader progress bar. */ -export const startHolyProgress = (): void => { +export const startHolyLoader = (): void => { document.dispatchEvent(new Event(START_HOLY_EVENT)); }; /** * Dispatches the event to manually stop the HolyLoader progress bar. */ -export const stopHolyProgress = (): void => { +export const stopHolyLoader = (): void => { document.dispatchEvent(new Event(STOP_HOLY_EVENT)); };