B2G/gecko/services/sync/modules/engines.js
/**
   * Register an Engine to the service. Alternatively, give an array of engine
   * objects to register.
   *
   * @param engineObject
   *        Engine object used to get an instance of the engine
   * @return The engine object if anything failed
   */
Register an Engine to the service. Alternatively, give an array of engine
objects to register.

@param engineObject
Engine object used to get an instance of the engine
@return The engine object if anything failed
Register an Engine to the service . Alternatively give an array of engine objects to register . @param engineObject Engine object used to get an instance of the engine @return The engine object if anything failed
function EngMgr_register(engineObject) {
    if (Array.isArray(engineObject))
      return engineObject.map(this.register, this);
    try {
      let engine = new engineObject();
      let name = engine.name;
      if (name in this._engines)
        this._log.error("Engine '" + name + "' is already registered!");
      else
        this._engines[name] = engine;
    }
    catch(ex) {
      let mesg = ex.message ? ex.message : ex;
      let name = engineObject || "";
      name = name.prototype || "";
      name = name.name || "";
      let out = "Could not initialize engine '" + name + "': " + mesg;
      this._log.error(out);
      return engineObject;
    }
  }
function EngMgr_register ( engineObject ) { if ( Array . isArray ( engineObject ) ) return engineObject . map ( this . register , this ) ; try { let engine = new engineObject ( ) ; let name = engine . name ; if ( name in this . _engines ) this . _log . error ( "Engine '" + name + "' is already registered!" ) ; else this . _engines [ name ] = engine ; } catch ( ex ) { let mesg = ex . message ? ex . message : ex ; let name = engineObject || "" ; name = name . prototype || "" ; name = name . name || "" ; let out = "Could not initialize engine '" + name + "': " + mesg ; this . _log . error ( out ) ; return engineObject ; } }
Register an Engine to the service.
Register an Engine to the service .