[openstreetmap/openstreetmap-website] Instantiate js controllers only once needed (PR #6295)

Marwin Hochfelsner notifications at github.com
Tue Aug 26 16:17:40 UTC 2025


@hlfan commented on this pull request.



> -  addNoteButton.on("click", function (e) {
-    e.preventDefault();
-    e.stopPropagation();
-
-    if ($(this).hasClass("disabled")) return;
-
-    OSM.router.route("/note/new");
-  });

Every other affected event handler interacts with the `map`, which wouldn't be available in an IIFE.
I'd like to do the same for all of these, even if it's not required for this specific example.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6295#discussion_r2301505018
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6295/review/3156406732 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250826/edec7c52/attachment.htm>


More information about the rails-dev mailing list