Make basic flippy example

Fix minor bugs related with it: bind API methods, correct states order,
pass previous state to the state callback