对象不支持 属性 或方法 'getAll'

Object doesn't support property or method 'getAll'

我正在尝试在我的应用程序中实现服务工作者,我已经在 Chrome、Firefox 和 Safari 中成功实现了这一点,但在 IE 中还没有完全实现。到目前为止,我能够创建对象存储并向其中添加数据,但是当我调用 getAll() 时,出现以下错误:

SCRIPT438: Object doesn't support property or method 'getAll'

这是我正在尝试的代码 运行:

var docDB = indexedDB.open("docDB", 1); 
        docDB.onsuccess = function(event) {
            var db                      = docDB.result;
            var tx                      = db.transaction("documents", "readwrite");
            var docStore                = tx.objectStore("documents");
            var docStoreRequest         = docStore.getAll();
            docStoreRequest.onsuccess   = function(event) {
                var rowHTML = '';
                $.each( docStoreRequest.result, function( index, value ){
                    var id          = $(this)[0].id;
                });
            };

IE 和 Edge 都不支持所有的 IndexedDB 规范。缺少的东西之一是 getAll。幸运的是,there is a polyfill you can use.