-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Explicit12/FN-1816_Remove-stores-from-loa…
…ders_Dmytro-Holdobin Remove stores from loaders
- Loading branch information
Showing
9 changed files
with
106 additions
and
130 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
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,19 @@ | ||
import { readonly, ref } from "vue"; | ||
|
||
const isRenderingPage = ref(true); | ||
|
||
function setRenderingStarted() { | ||
isRenderingPage.value = true; | ||
} | ||
|
||
function setRenderingFinished() { | ||
isRenderingPage.value = false; | ||
} | ||
|
||
export default function useLoaderRendering() { | ||
return { | ||
isRenderingPage: readonly(isRenderingPage), | ||
setRenderingStarted, | ||
setRenderingFinished, | ||
}; | ||
} |
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 was deleted.
Oops, something went wrong.
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,57 @@ | ||
import { ref, readonly } from "vue"; | ||
|
||
const isLoading = ref(false); | ||
const requestQueue = ref([]); | ||
const loaderRequestQueue = ref([]); | ||
const loaderRequestTimeout = ref(0); | ||
const componentLoaderRequestQueue = ref([]); | ||
|
||
function setLoadingOn(url) { | ||
loaderRequestQueue.value.push(url); | ||
|
||
isLoading.value = true; | ||
|
||
clearTimeout(loaderRequestTimeout.value); | ||
} | ||
|
||
function setLoadingOff(url) { | ||
loaderRequestQueue.value = url ? loaderRequestQueue.value.filter((item) => item !== url) : []; | ||
|
||
loaderRequestTimeout.value = setTimeout(() => { | ||
if (!loaderRequestQueue.value.length) { | ||
isLoading.value = false; | ||
} | ||
}, 50); | ||
} | ||
|
||
function addRequestUrl(url) { | ||
requestQueue.value.push(url); | ||
} | ||
|
||
function removeRequestUrl(url) { | ||
requestQueue.value = requestQueue.value.filter((item) => item !== url); | ||
} | ||
|
||
function setComponentRequestQueue(requests) { | ||
componentLoaderRequestQueue.value = [...componentLoaderRequestQueue, ...requests]; | ||
} | ||
|
||
function removeComponentRequestQueue() { | ||
componentLoaderRequestQueue.value = []; | ||
} | ||
|
||
export default function useLoaderTop() { | ||
return { | ||
isLoading: readonly(isLoading), | ||
requestQueue: readonly(requestQueue), | ||
loaderRequestQueue: readonly(loaderRequestQueue), | ||
loaderRequestTimeout: readonly(loaderRequestTimeout), | ||
componentLoaderRequestQueue: readonly(componentLoaderRequestQueue), | ||
setLoadingOn, | ||
setLoadingOff, | ||
addRequestUrl, | ||
removeRequestUrl, | ||
setComponentRequestQueue, | ||
removeComponentRequestQueue, | ||
}; | ||
} |
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 was deleted.
Oops, something went wrong.
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