save state to switch to create a total.js version