[openstreetmap/openstreetmap-website] Instantiate js controllers only once needed (PR #6295)
Pablo Brasero
notifications at github.com
Thu Nov 6 16:02:58 UTC 2025
@pablobm commented on this pull request.
> - addNoteButton.on("click", function (e) {
- e.preventDefault();
- e.stopPropagation();
-
- if ($(this).hasClass("disabled")) return;
-
- OSM.router.route("/note/new");
- });
In the interest of separation of concerns, would it be possible to move these back into their modules, but as functions that can are called from `initializeMapButtons`?
So for example, this code here could live as `OSM.NewNote.initialize()`, called from `OSM.initializeMapButtons`.
It's not trivial because then there's the question of what to do with the routes, which are functions... I played a bit with the idea at https://github.com/hlfan/openstreetmap-website/compare/lazy-load-controllers...pablobm:lazy-load-controllers. What do you think?
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6295#discussion_r2499621731
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6295/review/3429020948 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251106/dd4ba683/attachment.htm>
More information about the rails-dev
mailing list