Web Component: j-Importer
j-Importer
j-Import is a great component for importing HTML templates, scripts or styles according to the path and condition. The component can help with SPA applications because you can easily import templates, scripts or styles dynamically.
- jComponent
v19|v20
Configuration:
if
{String}
needs to contain a valueurl
{String}
relative/absolute URL to a subpage or subpartreload
{String}
a link to method in the global scope, it's executed if the condition is validcleaner
{Number}
(optional) idle time (in minutes) for running of cleaning (default:0
)clean
{String}
(optional) a link to function, it's executed before the importer is cleanedid
{String}
a custom identifier for replacing~ID~
phrases in the imported HTML (default: empty)- NEW:
singleton
{Boolean}
it handles only the one instance of importer according to thepath + if + url
(default:false
) - NEW:
parent
{String}
it moves itself as a direct child of theparent
selector - NEW:
adapt
{Boolean}
iftrue
it calls thereload:?/soemthing
method for the nested plugin instead of the current plugin (default:false
)
New update:
j-Importer can contain <script type="text/html">
with a content which will be evaluated as HTML if the condition will be valid.
Good to know 1:
- all
CLASS
and~PATH~
phrases will be replaced byconfig.path
orconfig.if
automatically - all
~ID~
phrases will be replaced byconfig.id
automatically - importer automatically replaces
<SCR>
elements to<script>
elements only within<script type="text/html">
template
Good to know 2:
If the part component isn't within scope then the value from the config.if
will replace ?
characters in all config keys.
Author
- Peter Širka petersirka@gmail.com
- License
Created
18. august 2016
Updated
13. november 2024
jComponent library
19 | 20
Version
v1
License
https://www.totaljs.com/license/
Responsive
Yes
Author
Peter Širka
Email
petersirka@gmail.com