[openstreetmap/openstreetmap-website] Remove jQuery throttle-debounce dependency (PR #6811)
Pablo Brasero
notifications at github.com
Wed Jun 17 13:20:46 UTC 2026
@pablobm commented on this pull request.
> @@ -39,14 +38,17 @@ document.addEventListener("DOMContentLoaded", function () {
parent.postMessage({ type, data }, location.origin);
}
- id.map().on("move.embed", window.Cowboy.throttle(250, function () {
- if (id.inIntro()) return;
- const zoom = ~~id.map().zoom(),
- center = id.map().center(),
- llz = { lon: center[0], lat: center[1], zoom: zoom };
+ id.map().on("move.embed-init", function () {
+ id.map().on("move.embed-init", null);
Can you only place one single handler on a given event then? In other frameworks, I would expect something like this:
```js
function eventHandler() {
id.map().off("move.embed-init", eventHandler);
// ...
}
id.map().on("move.embed-init", eventHandler);
```
Trying to look up `off` and it doesn't appear to exist, so I'm guessing that's the case. Probably the reason why `once` doesn't exist either!
How about a comment?
```suggestion
// D3.js doesn't give us a better way to ensure
// that this handler runs only once.
id.map().on("move.embed-init", null);
```
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6811#discussion_r3428442502
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6811/review/4515967169 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260617/12dec415/attachment.htm>
More information about the rails-dev
mailing list