dist/lib/methods/indexed-db.js
function writeMessage(db, readerUuid, messageJson) {
  var time = new Date().getTime();
  var writeObject = {
    uuid: readerUuid,
    time: time,
    data: messageJson
  };
  var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite');
  return new Promise(function (res, rej) {
    transaction.oncomplete = function () {
      return res();
    };

    transaction.onerror = function (ev) {
      return rej(ev);
    };

    var objectStore = transaction.objectStore(OBJECT_STORE_ID);
    objectStore.add(writeObject);
  });
}
function writeMessage(db, readerUuid, messageJson) {
  var time = new Date().getTime();
  var writeObject = {
    uuid: readerUuid,
    time: time,
    data: messageJson
  };
  var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite');
  return new Promise(function (res, rej) {
    transaction.oncomplete = function () {
      return res();
    };

    transaction.onerror = function (ev) {
      return rej(ev);
    };

    var objectStore = transaction.objectStore(OBJECT_STORE_ID);
    objectStore.add(writeObject);
  });
}
function writeMessage ( db , readerUuid , messageJson ) { var time = new Date ( ) . getTime ( ) ; var writeObject = { uuid : readerUuid , time : time , data : messageJson } ; var transaction = db . transaction ( [ OBJECT_STORE_ID ] , 'readwrite' ) ; return new Promise ( function ( res , rej ) { transaction . oncomplete = function ( ) { return res ( ) ; } ; transaction . onerror = function ( ev ) { return rej ( ev ) ; } ; var objectStore = transaction . objectStore ( OBJECT_STORE_ID ) ; objectStore . add ( writeObject ) ; } ) ; }
writes the new message to the database
so other readers can find it
writes the new message to the database so other readers can find it