deleteQuery(entityClass, filter, order, offset, limit) {
    validateEntityClass(entityClass)

    let objectStoreName = entityClass.objectStore
    let objectStore = this[PRIVATE.transaction].getObjectStore(objectStoreName)
    let keyPath = objectStore.keyPath

    return new Promise((resolve, reject) => {
      let queryPromise = objectStore.query(
        filter,
        order,
        offset,
        limit
      ).then((records) => {
        // Since we have no guarantee under what module path the
        // indexed-db.es6's PromiseSync class will be available, we have to
        // obtain a reference to it like this
        const PromiseSync = queryPromise.constructor
        return PromiseSync.all(records.map((record) => {
          let primaryKey = getPrimaryKey(record, keyPath)
          return objectStore.delete(primaryKey).then(() => {
            let entityManager = this[PRIVATE.entityManager]
            if (!entityManager.containsByPrimaryKey(entityClass, primaryKey)) {
              return
            }

            return entityManager.find(
              entityClass,
              primaryKey
            ).then((entity) => {
              entityManager.detach(entity)
            })
          })
        })).then(() => records.length)
      }).then(resolve).catch(reject)
    })
  }
/**
   * Executes a delete query, deleting all entities matched by the specified
   * query.
   *
   * @param {function(new: AbstractEntity, Object<string, *>)} entityClass The
   *        entity class specifying the type of entity to match by the query.
   * @param {?(undefined|number|string|Date|Array|IDBKeyRange|Object<string, (number|string|Date|Array|IDBKeyRange)>|function(*, (number|string|Date|Array)): boolean)=} filter
   *        The filter, restricting the records deleted by this method. If a
   *        function is provided, the first argument will be set to the record
   *        and the second argument will be set to the primary key of the
   *        record.
   * @param {?(CursorDirection|string|string[]|function(*, *): number)} order
   *        How the records should be sorted.
   * @param {number} offset The index of the first record to delete. The
   *        records are numbered from {@code 0}, the offset must be a
   *        non-negative integer.
   * @param {?number} limit The maximum number of records to delete. The limit
   *        must be a positive integer, or {@code null} if no limit should be
   *        imposed.
   * @return {Promise<number>} A promise that will resolve after the records
   *         have been deleted. The promise will resolve to the number of
   *         deleted records.
   */
Executes a delete query, deleting all entities matched by the specified
query.

@param {function(new: AbstractEntity, Object)} entityClass The
entity class specifying the type of entity to match by the query.
Executes a delete query deleting all entities matched by the specified query . @param { function ( new : AbstractEntity Object ) } entityClass The entity class specifying the type of entity to match by the query .
deleteQuery(entityClass, filter, order, offset, limit) {
    validateEntityClass(entityClass)
    let objectStoreName = entityClass.objectStore
    let objectStore = this[PRIVATE.transaction].getObjectStore(objectStoreName)
    let keyPath = objectStore.keyPath
    return new Promise((resolve, reject) => {
      let queryPromise = objectStore.query(
        filter,
        order,
        offset,
        limit
      ).then((records) => {
        const PromiseSync = queryPromise.constructor
        return PromiseSync.all(records.map((record) => {
          let primaryKey = getPrimaryKey(record, keyPath)
          return objectStore.delete(primaryKey).then(() => {
            let entityManager = this[PRIVATE.entityManager]
            if (!entityManager.containsByPrimaryKey(entityClass, primaryKey)) {
              return
            }
            return entityManager.find(
              entityClass,
              primaryKey
            ).then((entity) => {
              entityManager.detach(entity)
            })
          })
        })).then(() => records.length)
      }).then(resolve).catch(reject)
    })
  }
deleteQuery ( entityClass , filter , order , offset , limit ) { validateEntityClass ( entityClass ) let objectStoreName = entityClass . objectStore let objectStore = this [ PRIVATE . transaction ] . getObjectStore ( objectStoreName ) let keyPath = objectStore . keyPath return new Promise ( ( resolve , reject ) => { let queryPromise = objectStore . query ( filter , order , offset , limit ) . then ( ( records ) => { const PromiseSync = queryPromise . constructor return PromiseSync . all ( records . map ( ( record ) => { let primaryKey = getPrimaryKey ( record , keyPath ) return objectStore . delete ( primaryKey ) . then ( ( ) => { let entityManager = this [ PRIVATE . entityManager ] if ( ! entityManager . containsByPrimaryKey ( entityClass , primaryKey ) ) { return } return entityManager . find ( entityClass , primaryKey ) . then ( ( entity ) => { entityManager . detach ( entity ) } ) } ) } ) ) . then ( ( ) => records . length ) } ) . then ( resolve ) . catch ( reject ) } ) }
Executes a delete query, deleting all entities matched by the specified
 query.
Executes a delete query deleting all entities matched by the specified query .
// Since we have no guarantee under what module path the // indexed-db.es6's PromiseSync class will be available, we have to // obtain a reference to it like this