RTO_favoritesList.js

Helper file documentation for RTO_favoritesList.js.
Docs updated: 2026-03-24

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 7.13.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