JavaScript state machine supporting most UML 2 features