Skip to content

ES module compatibility

Compare
Choose a tag to compare
@Twikito Twikito released this 05 Oct 19:45
· 66 commits to master since this release

Easy Toggle State is a library that was thought from the beginning to be used in a quick and easy way.
Responding to the requests, it now can be used in ESM projects. 🎉

Initializing, unbinding a trigger, unbinding all triggers and getting the state of a trigger are now exposed and ready to be used by yourself:

import initialize, { isActive, unbind, unbindAll } from "easy-toggle-state";

const handler = () => {
	initialize();
	document.removeEventListener("DOMContentLoaded", handler);
};
document.addEventListener("DOMContentLoaded", handler);

window.easyToggleState = Object.assign(
	initialize,
	{
		isActive,
		unbind,
		unbindAll
	}
);

Learn more in the new API section in the documentation.

Happy toggling 🖖