Simple event sourced entity implementation in JavaScript