Favorites list helper

List saved destinations so an operator can relaunch useful pages without rebuilding the whole route each time.
RTO_helpers Copy/paste ready Product-grade integration
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.js

Example

<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 entries
  • RTOFavorites.has(url, timeoutMs?) → Promise<boolean>
  • RTOFavorites.add(url, label, timeoutMs?) → extension response object
  • RTOFavorites.remove(url, timeoutMs?) → extension response object
  • RTOFavorites.cached() → cached snapshot
  • RTOFavorites.hasCached(url) → URL-based cached lookup

Next