The z4m_dynlibloading module makes JS libraries and CSS style sheets easy to load on demand.
- No need to specify the relative URL of the web resource to load. Just indicate the resource file name (without extension) and in option, the module name where the resource is located.
- A version number is added to the URL to force the resource to be reloaded when its content has changed (useful during App development).
- the minified or not minified version of the resource is loaded according to the ZnetDK 4 Mobile App settings.
This module is published under the version 3 of GPL General Public Licence.
- ZnetDK 4 Mobile version 2.0 or higher,
- PHP version 7.4 or higher.
- Add a new subdirectory named
z4m_dynlibloading
within the./engine/modules/
subdirectory of your ZnetDK 4 Mobile starter App, - Copy module's code in the new
./engine/modules/z4m_dynlibloading/
subdirectory, or from your IDE, pull the code from this module's GitHub repository,
To add to the document one or more JS and CSS resources:
const libLoading = new Z4MDynLibLoading();
libLoading.addJSLibrary('myjslib', 'mymodule'); // Located in 'mymodule'
libLoading.addCSSStyleSheet('mystylesheet'); // Located in 'app'
libLoading.loadAll();
To import a JS Module script:
const libLoading = new Z4MDynLibLoading();
libLoading.importJSLib('myjsmodulelib', 'mymodule');
See CHANGELOG.md file.
Your contribution to the ZnetDK 4 Mobile project is welcome. Please refer to the CONTRIBUTING.md file.