Migrated from: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/277
...because it is nearly impossible to write tests that do not bleed into each other right now.
Migrated from: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/277
...because it is nearly impossible to write tests that do not bleed into each other right now.
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Turn mmv-next/mmv-prev into OO events | mediawiki/extensions/MultimediaViewer | master | +43 -39 |
The point of having events that don't have to be pushed to a specific element or listened to on a specific element is decoupling. Maybe some events we currently have can be removed. Maybe we can use a different event system than one that goes through the DOM. But it sounds like you want to go back to targeting specific DOM elements, which is counter-productive in terms of making these events useful for 3rd-parties. At any rate your proposed change should not make use of a reference to the viewer object from the interface. These back-references are what made this codebase horrible to begin with.
Thanks for doing #278 ! That was the main motivation about this change, but I think it has some merit even after that. The current event system uses a global channel (the window), with the usual benefits and costs of globals: always conveniently available, but cannot be mocked or isolated.
I agree that using the DOM would be a step back, but jQuery can pass events outside it with almost zero added complexity. I won't continue work on this unless we have consensus that it is useful, but I'll upload the work already done yesterday, that will give a better picture of how I imagined it.
Change 173916 had a related patch set uploaded (by Gergő Tisza):
Turn mmv-next/mmv-prev into OO events
Mass-removing the Multimedia tag from MediaViewer tasks, as this is now being worked on by the Reading department, not Editing's Multimedia team.