Script authors: changes to the repositories API
Hey everyone,
With today's release of the Waze Map Editor the methods available for repositories such as the segments, streets and users have been adjusted slightly. Whereas previously you could get an object with the .get() method (example: W.model.streets.get(someStreetId);), you now need to use .getObjectById() instead.
At the moment, .get() is still available as a proxy to the new .getObjectById() method, but it will be removed in an upcoming release of the WME (no fixed date, depends slightly on how many scripts would become broken at that point). Whenever a script currently uses .get(), a notification message will be logged in the web console of your browser. Therefore it is advised to update your userscripts in the following weeks. The change is minimal, but here's an example to help you out:
Should be replaced with
The same applies for all these repositories under W.model:
segments, nodes, users, streets, cities, states, countries, problems, mapUpdateRequests, venues, junctions, bigJunctions, roadClosures, cameras, userAreas, problemDetails, houseNumbers, updateRequestSessions, archives, archiveSessions, managedAreas, majorTrafficEvents, restrictedAreas and mapComments.
I've gone through the userscripts known to the Discord !script command and found these userscripts to be affected by this:
Overview spreadsheet of affected scripts
FYI: there may also still be some calls to the get() function within the vanilla WME code though. They should mostly be gone, but I've found at least one such call already (when selecting a segment with a road closure). So don't necessarily think any such messages are always caused by your own scripts. Usually that will be the case though
Thanks for all your awesome work!
With today's release of the Waze Map Editor the methods available for repositories such as the segments, streets and users have been adjusted slightly. Whereas previously you could get an object with the .get() method (example: W.model.streets.get(someStreetId);), you now need to use .getObjectById() instead.
At the moment, .get() is still available as a proxy to the new .getObjectById() method, but it will be removed in an upcoming release of the WME (no fixed date, depends slightly on how many scripts would become broken at that point). Whenever a script currently uses .get(), a notification message will be logged in the web console of your browser. Therefore it is advised to update your userscripts in the following weeks. The change is minimal, but here's an example to help you out:
Code: Select all
W.model.users.get(267294555);
Code: Select all
W.model.users.getObjectById(267294555);
segments, nodes, users, streets, cities, states, countries, problems, mapUpdateRequests, venues, junctions, bigJunctions, roadClosures, cameras, userAreas, problemDetails, houseNumbers, updateRequestSessions, archives, archiveSessions, managedAreas, majorTrafficEvents, restrictedAreas and mapComments.
I've gone through the userscripts known to the Discord !script command and found these userscripts to be affected by this:
Code: Select all
WME Advanced Closures
WME Bookmarks
WME ClickSaver
WME Closure Details
WME Color Speeds
WME Form Filler
WME Junction Angle Info
WME MagicWand
WME Map Tiles Update
WME PL Jump
WME Place Harmonizer
WME Place Interface Enhancements
WME PlaceNames
WME RA Util
WME Reverse Nodes
WME Road History
WME Road Selector
WME Route Checker
WME Route Speeds (MoM fork)
WME Select Same Type Roads
WME Show Alt Names
WME Speedlimits
WME Street to River PLUS
WME UR Comments
WME UR-MP Tracking
WME Validator
FYI: there may also still be some calls to the get() function within the vanilla WME code though. They should mostly be gone, but I've found at least one such call already (when selecting a segment with a road closure). So don't necessarily think any such messages are always caused by your own scripts. Usually that will be the case though
Thanks for all your awesome work!
Re: Script authors: changes to the repositories API