Show / hide element using actions
AvoidJS is a simple experimental library the main purpose of which is too provide a tool and the code style that helps to separate HTML and JS code completely.
The cornerstone of AvoidJS is events and actions. UI part reacts to the events that JS part produces and performs actions based on them. This makes JS code 100% UI-agnostic, which means that JS code now can focus solely on application logic and don't worry about UI.
So if regular code would loook something like this:
With AvoidJS it will look something like this:
So as you can see JS code doesn't care how UI will react to the result of the action, while HTML code only cares about UI and waits for events to fire.
While the future of the project remains uncertain, these are current priorities:
If you want to learn more about the library, you can take a look at the source code on github or view the source code of this website as it uses AvoidJS for every UI part.