Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve decoupling of JS code ('model') and view #5830

Closed
timvandermeij opened this issue Mar 11, 2015 · 2 comments
Closed

Improve decoupling of JS code ('model') and view #5830

timvandermeij opened this issue Mar 11, 2015 · 2 comments
Labels

Comments

@timvandermeij
Copy link
Contributor

From #5803 it seems that implementers are trying to monkey-patch our code instead of creating their own components. Instead of adding complexity to check if DOM elements exist before binding event listeners etc., we should make sure that the JS code ('model') is decoupled as much as possible from the view to make life for skinned viewers easier.

@Rob--W
Copy link
Member

Rob--W commented Mar 12, 2015

We don't need to change the code structure in order to support skinned viewers.
In the linked PR, the author seems to have removed some HTML in order to "skin" the viewer. The JS logic that supports these modules is still present, even though the UI controls are gone. Since (library) code size is not a concern in this case, they (third-party developers) can simply use CSS to change the appearance of the viewer (and use e.g. display:none to hide certain controls).

For anything more flexible than that, we have to support optional features (e.g. via //#if .. //#endif) or plugins. This is not a trivial effort, but PRs are welcome, I guess.

@timvandermeij
Copy link
Contributor Author

You are right. We have already decoupled the viewer code a lot by moving the different components into seperate files and classes. Now skinned viewers can disable functionality more easily. Since there are no other concrete plans to improve this even further, I'm closing this as solved. PRs are still welcome if there are places where even more decoupling is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants