B2G/gecko/services/aitc/modules/storage.js
/**
   * Add an object to the queue, and data is saved to disk.
   */
Add an object to the queue, and data is saved to disk.
Add an object to the queue and data is saved to disk .
function enqueue(obj, cb) {
    this._log.info("Adding to queue " + obj);
    if (!cb) {
      throw new Error("enqueue called without callback");
    }
    let self = this;
    this._queue.push(obj);
    try {
      this._putFile(this._queue, function _enqueuePutFile(err) {
        if (err) {
          self._queue.pop();
          cb(err, false);
          return;
        }
        cb(null, true);
        return;
      });
    } catch (e) {
      self._queue.pop();
      cb(e, false);
    }
  }
function enqueue ( obj , cb ) { this . _log . info ( "Adding to queue " + obj ) ; if ( ! cb ) { throw new Error ( "enqueue called without callback" ) ; } let self = this ; this . _queue . push ( obj ) ; try { this . _putFile ( this . _queue , function _enqueuePutFile ( err ) { if ( err ) { self . _queue . pop ( ) ; cb ( err , false ) ; return ; } cb ( null , true ) ; return ; } ) ; } catch ( e ) { self . _queue . pop ( ) ; cb ( e , false ) ; } }
Add an object to the queue, and data is saved to disk.
Add an object to the queue and data is saved to disk .
// Write unsuccessful, don't add to queue. // Successful write.