The current implementation of hash handling has some drawbacks:
- It happens as a complex interaction between the viewer and the bootstrap classes, which is hard to follow, and causes mmv.js hash handling to not work when it is loaded by some other means than the bootstrap. (Also, we use to flags for the same thing, viewer.comingFromHashChange, and the closure scope variablecomingFromHashChange - that is probably unintentional)
- It has too much low-level detail, mmv.js should be a high-level class coordinating other classes.
- It is hard to scale; plugins will probably want to interact with the hash.
We now have a standard library used by other extensions - mediawiki.router - that would be better.
We should come up with a better system; probably remove most hash handling from the bootstrap (it should just listen to hash changes while the viewer is not loaded, then once it detects a MediaViewer/... hash, unregister itself,load the viewer and call its hash handler), and come up with some sort of routing system.