javascript api for implementing ViewModel design pattern