diff options
Diffstat (limited to 'typescript/src/entrypoint.ts')
-rw-r--r-- | typescript/src/entrypoint.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/typescript/src/entrypoint.ts b/typescript/src/entrypoint.ts new file mode 100644 index 0000000..e939d92 --- /dev/null +++ b/typescript/src/entrypoint.ts @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: AGPL-3.0-or-later */ + +import type EntrypointParameter from "./EntrypointParameter.js"; +import getAjaxResponse from "./getAjaxResponse.js"; +import getAjaxSettings from "./getAjaxSettings.js"; +import getNewHTML from "./getNewHTML.js"; +import listenToChangeEvent from "./listenToChangeEvent.js"; +import placeholder from "./placeholder.js"; +import reRenderComponent from "./reRenderComponent.js"; +import setContentEditable from "./setContentEditable.js"; +import typescriptExhaustive from "./typescriptExhaustive.js"; + +export default async ( + EntrypointParameter: EntrypointParameter +): Promise<void> => { + try { + Object.freeze(EntrypointParameter); + typescriptExhaustive(EntrypointParameter); + + window.scroll(0, 0); + reRenderComponent(placeholder); + + const AjaxSettings = getAjaxSettings(EntrypointParameter); + const AjaxResponse = await getAjaxResponse(AjaxSettings); + const newHTML = getNewHTML(AjaxSettings, AjaxResponse); + reRenderComponent(newHTML); + + listenToChangeEvent(EntrypointParameter); + setContentEditable(); + } catch (error) { + console.warn({ error }); + } +}; |