Skip to content

1601com/SimpleAsyncLoaderJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

SimpleAsyncLoaderJS

DE - Führe einfach die Funktionen von async geladenen JavaScript Dateien aus


EN - Just execute the functions of async loaded JavaScript files


Example html

<!doctype html>
<html lang="en">
<head>
    <title>SimpleAsyncLoaderJS</title>
    <script src="SimpleAsyncLoaderJS.js" async></script>
    <script src="my-script.js" async></script>
</head>
<body>
</body>
</html>

Example asyncFunctions array

if (typeof asyncFunctions === "undefined") {
   var asyncFunctions = [];
}
asyncFunctions.push(function() {
    console.log('called')
});

Example data-script-function.js

function dataScriptFunction() {
    console.log('example-data-script called', document.getElementById('element'));
}
<script src="data-script-function.js" async data-script-function="dataScriptFunction"></script>

Usage CMS Contao >4.9

https://contao.org/

  1. Install agentur1601com/file-lazy-loader
$ composer require agentur1601com/file-lazy-loader
  1. Go to Themes -> Page layout -> FileLazyLoader - JS

  2. Load your JavaScript files async


@Author: Lukas Beck

@Email: [email protected]

@Link: https://github.com/LBeckX

@Copyright 1601.communication gmbh

@Link: https://www.1601.com

@Link: https://github.com/1601com

@Support: [email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published