Favorites list helper
List saved destinations so an operator can relaunch useful pages without rebuilding the whole route each time.
Best for
Dashboards, saved destinations, and operator shortcuts.
Load with
RTO_form_api.js first.
Works well with
RTO_addRemovefavorite.js and favorites-focused pages.
Summary
Favorites API wrapper.
- Exports:
RTOFavorites - Uses extension pass-through:
getData(target:favorites),addFavorite,removeFavorite
What it is
Favorites API helper (list / has / add / remove).
In 8.5.0, favorites are normalized by URL, duplicates are merged by URL, and labels are kept when available.
has() and hasCached() are URL-based checks.
Download
Download RTO_favoritesList.jsExample
<script src="../RTO_helpers/RTO_favoritesList.js"></script>
<script>
(function(){
RTOFavorites.add("https://example.com", "Example").then(function(ans){
if (!ans || ans.ok === false) {
console.warn("Could not add favorite");
return [];
}
return RTOFavorites.list();
}).then(function(list){
console.log("favorites:", list);
console.log("has example?", RTOFavorites.hasCached("https://example.com"));
});
})();
</script>
How duplicates are handled
If the same URL is added more than once, the helper keeps one normalized entry for that URL.
A label is preserved when one is available.
API
RTOFavorites.list(timeoutMs?)→Promise<Array>of normalized favorite entriesRTOFavorites.has(url, timeoutMs?)→Promise<boolean>RTOFavorites.add(url, label, timeoutMs?)→ extension response objectRTOFavorites.remove(url, timeoutMs?)→ extension response objectRTOFavorites.cached()→ cached snapshotRTOFavorites.hasCached(url)→ URL-based cached lookup