我想使用IDBKeyRange.only()判断Date是否相等

时间:2019-03-08 08:12:41

标签: javascript indexeddb

function dataBaseFilter(filterIndex, range, callBack) {
  let objectStore = db.transaction([objectStoreName], "readwrite").objectStore(objectStoreName);
  let filter = objectStore.index(filterIndex);
  let rangeFilter = IDBKeyRange.only(range); //弄清其内在机制,==?
  let baseStruct;
  let documentFragment = document.createDocumentFragment();
  filter.openCursor(rangeFilter, "next").onsuccess = function(event) {
    cursor = event.target.result;
    if (cursor) {
      let result = cursor.value;
      console.log(result);
      displaySomeThingAtOnce(result);
      baseStruct = getCompleteTask(result);
      documentFragment.appendChild(baseStruct);
      callBack(documentFragment);
      cursor.continue();
    }

  }

}

我想使用IDBKeyRange.only()来判断日期是否相等,但是我不知道为什么。但是如果我必须使用IDBKeyRange.only()来判断日期是否相等,我应该怎么做?

0 个答案:

没有答案