commit() {
    if (!this[PRIVATE.active]) {
      throw new Error("The transaction is no longer active")
    }

    this[PRIVATE.active] = false

    if (!this[PRIVATE.transactionRunner]) {
      return this[PRIVATE.transactionRunnerPromise].then(() => {
        this[PRIVATE.active] = true
        return this.commit()
      })
    }

    if (!this[PRIVATE.transactionRunner].isActive) {
      throw new Error("The transaction is no longer active")
    }

    // save the modified entities
    for (let entities of this[PRIVATE.entities].values()) {
      for (let {data, entity, foreign} of entities.values()) {
        if (!foreign && equals(entity, data)) {
          continue // the entity has not been modified
        }

        this[PRIVATE.transactionRunner].queueOperation((transaction) => {
          let objectStoreName = entity.constructor.objectStore
          let objectStore = transaction.getObjectStore(objectStoreName)
          objectStore.put(entity)
        })
      }
    }

    return this[PRIVATE.transactionRunner].commit().then(() => {
      // update the copy of persisted data in the entity manager
      for (let entities of this[PRIVATE.entities].values()) {
        for (let dataAndEntity of entities.values()) {
          dataAndEntity.data = clone(dataAndEntity.entity)
        }
      }

      this[PRIVATE.completionCallback]()
    })
  }
/**
   * Commits all changes done to the entities currently managed by the entity
   * manager that started this transaction, including the modifications made
   * BEFORE the transaction was started.
   *
   * @return {Promise<undefined>} A promise that will be resolved once the
   *         transaction has been committed.
   */
Commits all changes done to the entities currently managed by the entity
manager that started this transaction, including the modifications made
BEFORE the transaction was started.

@return {Promise} A promise that will be resolved once the
transaction has been committed.
Commits all changes done to the entities currently managed by the entity manager that started this transaction including the modifications made BEFORE the transaction was started . @return { Promise } A promise that will be resolved once the transaction has been committed .
commit() {
    if (!this[PRIVATE.active]) {
      throw new Error("The transaction is no longer active")
    }
    this[PRIVATE.active] = false
    if (!this[PRIVATE.transactionRunner]) {
      return this[PRIVATE.transactionRunnerPromise].then(() => {
        this[PRIVATE.active] = true
        return this.commit()
      })
    }
    if (!this[PRIVATE.transactionRunner].isActive) {
      throw new Error("The transaction is no longer active")
    }
    for (let entities of this[PRIVATE.entities].values()) {
      for (let {data, entity, foreign} of entities.values()) {
        if (!foreign && equals(entity, data)) {
          continue 
        }
        this[PRIVATE.transactionRunner].queueOperation((transaction) => {
          let objectStoreName = entity.constructor.objectStore
          let objectStore = transaction.getObjectStore(objectStoreName)
          objectStore.put(entity)
        })
      }
    }
    return this[PRIVATE.transactionRunner].commit().then(() => {
      for (let entities of this[PRIVATE.entities].values()) {
        for (let dataAndEntity of entities.values()) {
          dataAndEntity.data = clone(dataAndEntity.entity)
        }
      }
      this[PRIVATE.completionCallback]()
    })
  }
commit ( ) { if ( ! this [ PRIVATE . active ] ) { throw new Error ( "The transaction is no longer active" ) } this [ PRIVATE . active ] = false if ( ! this [ PRIVATE . transactionRunner ] ) { return this [ PRIVATE . transactionRunnerPromise ] . then ( ( ) => { this [ PRIVATE . active ] = true return this . commit ( ) } ) } if ( ! this [ PRIVATE . transactionRunner ] . isActive ) { throw new Error ( "The transaction is no longer active" ) } for ( let entities of this [ PRIVATE . entities ] . values ( ) ) { for ( let { data , entity , foreign } of entities . values ( ) ) { if ( ! foreign && equals ( entity , data ) ) { continue } this [ PRIVATE . transactionRunner ] . queueOperation ( ( transaction ) => { let objectStoreName = entity . constructor . objectStore let objectStore = transaction . getObjectStore ( objectStoreName ) objectStore . put ( entity ) } ) } } return this [ PRIVATE . transactionRunner ] . commit ( ) . then ( ( ) => { for ( let entities of this [ PRIVATE . entities ] . values ( ) ) { for ( let dataAndEntity of entities . values ( ) ) { dataAndEntity . data = clone ( dataAndEntity . entity ) } } this [ PRIVATE . completionCallback ] ( ) } ) }
Commits all changes done to the entities currently managed by the entity
 manager that started this transaction, including the modifications made
 BEFORE the transaction was started.
Commits all changes done to the entities currently managed by the entity manager that started this transaction including the modifications made BEFORE the transaction was started .
// save the modified entities // the entity has not been modified // update the copy of persisted data in the entity manager