B2G/gecko/toolkit/components/places/tests/unit/test_history_observer.js
/**
 * Registers a one-time history observer for and calls the callback
 * when the specified nsINavHistoryObserver method is called.
 */
Registers a one-time history observer for and calls the callback
when the specified nsINavHistoryObserver method is called.
Registers a one - time history observer for and calls the callback when the specified nsINavHistoryObserver method is called .
function onNotify(callback) {
  let obs = new NavHistoryObserver();
  obs[callback.name] = function () {
    PlacesUtils.history.removeObserver(this);
    callback.apply(this, arguments);
  };
  PlacesUtils.history.addObserver(obs, false);
}
function onNotify ( callback ) { let obs = new NavHistoryObserver ( ) ; obs [ callback . name ] = function ( ) { PlacesUtils . history . removeObserver ( this ) ; callback . apply ( this , arguments ) ; } ; PlacesUtils . history . addObserver ( obs , false ) ; }
Registers a one-time history observer for and calls the callback
 when the specified nsINavHistoryObserver method is called.
Registers a one - time history observer for and calls the callback when the specified nsINavHistoryObserver method is called .