B2G/gecko/toolkit/components/places/PlacesCategoriesStarter.js
/**
 * This component can be used as a starter for modules that have to run when
 * certain categories are invoked.
 */
This component can be used as a starter for modules that have to run when
certain categories are invoked.
This component can be used as a starter for modules that have to run when certain categories are invoked .
function PlacesCategoriesStarter()
{
  Services.obs.addObserver(this, TOPIC_GATHER_TELEMETRY, false);
  Services.obs.addObserver(this, PlacesUtils.TOPIC_SHUTDOWN, false);
  let notify = (function () {
    if (!this._notifiedBookmarksSvcReady) {
      Cc["@mozilla.org/categorymanager;1"]
        .getService(Ci.nsICategoryManager)
        .deleteCategoryEntry("bookmarks-observer", this, false);
      PlacesUtils.observe(null, "bookmarks-service-ready", null);
    }
  }).bind(this);
  [ "onItemAdded", "onItemRemoved", "onItemChanged", "onBeginUpdateBatch",
    "onEndUpdateBatch", "onBeforeItemRemoved", "onItemVisited",
    "onItemMoved" ].forEach(function(aMethod) {
      this[aMethod] = notify;
    }, this);
}
function PlacesCategoriesStarter ( ) { Services . obs . addObserver ( this , TOPIC_GATHER_TELEMETRY , false ) ; Services . obs . addObserver ( this , PlacesUtils . TOPIC_SHUTDOWN , false ) ; let notify = ( function ( ) { if ( ! this . _notifiedBookmarksSvcReady ) { Cc [ "@mozilla.org/categorymanager;1" ] . getService ( Ci . nsICategoryManager ) . deleteCategoryEntry ( "bookmarks-observer" , this , false ) ; PlacesUtils . observe ( null , "bookmarks-service-ready" , null ) ; } } ) . bind ( this ) ; [ "onItemAdded" , "onItemRemoved" , "onItemChanged" , "onBeginUpdateBatch" , "onEndUpdateBatch" , "onBeforeItemRemoved" , "onItemVisited" , "onItemMoved" ] . forEach ( function ( aMethod ) { this [ aMethod ] = notify ; } , this ) ; }
This component can be used as a starter for modules that have to run when
 certain categories are invoked.
This component can be used as a starter for modules that have to run when certain categories are invoked .
// nsINavBookmarkObserver implementation. // For perf reasons unregister from the category, since no further // notifications are needed. // Directly notify PlacesUtils, to ensure it catches the notification.