Conditioner
Frizz free, context-aware, JavaScript modulesBuilding a content based website?
Progressively enhancing it with a bit of interactivity?
Want to offer different interactivity based on user context?
Are you loading that interactivity like this?
var elements = Array.from(
document.querySelectorAll('.calendar')
);
elements.forEach(function(element) {
new Calendar(element);
});
Maybe dealing with those different user contexts like this?
window.addEventListener('resize', function() {
if (window.innerWidth >= 600) {
var elements = Array.from(
document.querySelectorAll('.calendar')
);
elements.forEach(function(element) {
new Calendar(element);
});
}
});
Conditioner takes care of all that initialisation logic.
<div data-module="ui/calendar"
data-context="@media (min-width:600px)">
</div>
Instead of writing endless loops and context checks, you can focus on building fun interactive functionality that enhances the user experience.