State

state is a small library to manage an element state by adding/removing
CSS classes, while maintaining a single class on the element whenever you change
the state of the element.
Setup
bower install lucasmazza/state --save
Or you can download a zip file.
Usage
state adds a small API to every DOM element to add/remove states.
import State from 'state';
const el = document.getElementById('container');
const state = new State(el);
state.set('loading');
state.set('done');
state.get();
state.set('loading');
state.leave('loading', () => console.log('Not "loading" anymore.'));
state.enter('loaded', () => console.log('Loaded!'));
state.set('loaded');
state.clear();
License
Copyright (c) 2014 Lucas Mazza. See LICENSE file.