Added in State support and the ability to switch states. Plus examples for both 'pure' JavaScript and TypeScript.