1.2.0 • Published 10 years ago
@pod-point/dom-module-loader v1.2.0
DOM Module Loader
Init
With POD Point Module Loader
import loadModules from '@pod-point/module-loader';
import combineDomModules from '@pod-point/dom-module-loader';
moduleLoader({
domModules: combineDomModules({
foo,
bar
})
});Solo
import combineDomModules from '@pod-point/dom-module-loader';
combineDomModules({
foo,
bar
}).init();DOM modules:
- Export an
initmethods - Initialised by adding the imported module name to an element's
data-js-moduleattribute. - Multiple names can be added and are space-delimited.
initis passed the element on which the module loader detected thedata-js-moduleattribute.- Can be initialised multiple times per page for different DOM modules.
- Can optionally export a
destroymethod, which is called on all active modules on subsequentload. - Are destroyed between page transitions.
Handling dynamic page transitions
combineDomModules({
foo,
bar
}).init();
combineDomModules.refresh();