async unshiftEntry()

in workbox-v4.3.1/workbox-background-sync.dev.js [84:114]


    async unshiftEntry(entry) {
      {
        assert_mjs.assert.isType(entry, 'object', {
          moduleName: 'workbox-background-sync',
          className: 'QueueStore',
          funcName: 'unshiftEntry',
          paramName: 'entry'
        });
        assert_mjs.assert.isType(entry.requestData, 'object', {
          moduleName: 'workbox-background-sync',
          className: 'QueueStore',
          funcName: 'unshiftEntry',
          paramName: 'entry.requestData'
        });
      }

      const [firstEntry] = await this._db.getAllMatching(OBJECT_STORE_NAME, {
        count: 1
      });

      if (firstEntry) {
        // Pick an ID one less than the lowest ID in the object store.
        entry.id = firstEntry.id - 1;
      } else {
        // Otherwise let the auto-incrementor assign the ID.
        delete entry.id;
      }

      entry.queueName = this._queueName;
      await this._db.add(OBJECT_STORE_NAME, entry);
    }