Added an option to abort the loader animation

canary
WolverinDEV 2020-10-05 10:44:44 +02:00
parent 130e64162a
commit df73618bd0
5 changed files with 16 additions and 4 deletions

View File

@ -132,8 +132,8 @@ export function abort() {
loopInterval = 0;
}
export function finalize() {
if(getUrlParameter("loader-abort") === "1") {
export function finalize(abortAnimation: boolean) {
if(abortAnimation) {
abort();
} else {
finalizing = true;

View File

@ -2,6 +2,7 @@ import * as script_loader from "./script_loader";
import * as style_loader from "./style_loader";
import * as template_loader from "./template_loader";
import * as Animation from "../animation";
import {getUrlParameter} from "./utils";
declare global {
interface Window {
@ -27,13 +28,15 @@ export interface Config {
error: boolean;
baseUrl: string;
abortAnimationOnFinish: boolean;
}
export let config: Config = {
loader_groups: false,
verbose: false,
error: true,
baseUrl: "./"
baseUrl: "./",
abortAnimationOnFinish: getUrlParameter("loader-abort") === "1"
};
export type Task = {
@ -298,7 +301,7 @@ export async function execute(customLoadingAnimations: boolean) {
if(config.verbose)
console.debug("[loader] finished loader. (Total time: %dms)", Date.now() - load_begin);
Animation.finalize();
Animation.finalize(config.abortAnimationOnFinish);
}
export function execute_managed(customLoadingAnimations: boolean) {

View File

@ -1,4 +1,5 @@
export interface Config {
abortAnimationOnFinish: boolean;
loader_groups: boolean;
verbose: boolean;
error: boolean;

View File

@ -326,6 +326,7 @@ const task_teaweb_starter: loader.Task = {
} else
$(document).one('click', () => aplayer.initializeFromGesture());
}
loader.config.abortAnimationOnFinish = settings.static_global(Settings.KEY_LOADER_ANIMATION_ABORT);
} catch (ex) {
console.error(ex.stack);
if(ex instanceof ReferenceError || ex instanceof TypeError)

View File

@ -498,6 +498,13 @@ export class Settings extends StaticSettings {
valueType: "boolean",
};
static readonly KEY_LOADER_ANIMATION_ABORT: ValuedSettingsKey<boolean> = {
key: 'loader_animation_abort',
defaultValue: false,
description: 'Abort the loader animation when the app has been finished loading',
valueType: "boolean",
};
static readonly FN_LOG_ENABLED: (category: string) => SettingsKey<boolean> = category => {
return {
key: "log." + category.toLowerCase() + ".enabled",