model is a global so you can assign the entity methods anywhere. I could have kept them outside of the onLoad event but the subscribeToMirrorApi method has to be in the onLoad event for the MirrorAPI to be bound without using a global variable, so it's nicer to have all the assignments in one place.

It could be more readable and less coupled to have a setupEntityMethods function that takes the model and MirrorApi as parameters that's invoked here instead.