From 1a18f3fc6f401515f2cffa18679339b9eddbe6e3 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Fri, 6 May 2022 14:50:22 +0200 Subject: [PATCH] Accept url parameter for custom delay Signed-off-by: Tilman Vatteroth --- src/components/application-loader/initializers/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/application-loader/initializers/index.ts b/src/components/application-loader/initializers/index.ts index e4ca979ee..0a5507bc5 100644 --- a/src/components/application-loader/initializers/index.ts +++ b/src/components/application-loader/initializers/index.ts @@ -12,7 +12,11 @@ import { fetchFrontendConfig } from './fetch-frontend-config' import { loadDarkMode } from './load-dark-mode' const customDelay: () => Promise = async () => { - if (window.localStorage.getItem('customDelay')) { + if ( + typeof window !== 'undefined' && + typeof window.localStorage !== 'undefined' && + (window.location.search.startsWith('?customDelay=') || window.localStorage.getItem('customDelay')) + ) { return new Promise((resolve) => setTimeout(resolve, 5000)) } else { return Promise.resolve()