2017-12-03 57 views
0

任何人都可以告訴我在調用dexie.js的count()函數時發生了什麼:TypeError (eval at getErrorWithStack(http://127.0.0.1:8081/elements/js/dexie.js:394:5),:1:19)在調用getErrorWithStack()方法時,可能無法訪問嚴格模式函數或調用它們的參數對象的'調用者','調用者'和'參數'屬性。 http://127.0.0.1:8081/elements/js/dexie.js:394:5) 在新的承諾(http://127.0.0.1:8081/elements/js/dexie.js:786:29) 在新的交易(http://127.0.0.1:8081/elements/js/dexie.js:2756:28) 在Dexie._createTransaction(http://127.0.0.1:8081/elements/js/dexie.js:1809:16) 在tempTransaction(http://127.0.0.1:8081/elements/js/dexie.js:1825:28) 在WriteableTable.getIDBObjectStore(http://127.0.0.1:8081/elements/js/dexie.js:2266:99) 在WriteableCollection._read(http://127.0.0.1:8081/elements/js/dexie.js:3454:42) 在WriteableCollection.count(http://127.0.0.1:8081/elements/js/dexie.js:3510:33) 在HTMLElement.checkLoadEnoughtOfflineData(http://127.0.0.1:8081/elements/base/app-localize-behavior.html:294:73) 上面最後一行是從我的函數調用:TypeError:可能無法在嚴格模式下訪問'調用者','調用者'和'參數'屬性dexie.js

checkLoadEnoughtOfflineData(idcheck) { 
     return dbOffline.checkPageTable.where("idCheck").equals(idcheck).count(); 
    } 

p/s:我正在使用谷歌Chorm 62.

回答

1

我假設你是調試器在這個位置休息。這是一段代碼,爲了生成錯誤,故意打破「嚴格」模式規則,以便可以從錯誤中挑選調用堆棧。如果你可以在調試器設置中忽略這種錯誤類型,鉻調試器將停止使用它。只有在Dexie.debug === true(這是本地主機提供的站點的默認值)時纔會發生。您在控制檯日誌中獲得的功能是未處理拒絕的異步堆棧跟蹤。你可以通過設置Dexie.debug = false來明確地關閉它。

來源是這樣的:

export function getErrorWithStack() { 
    "use strict"; 
    if (NEEDS_THROW_FOR_STACK) try { 
     // Doing something naughty in strict mode here to trigger a specific error 
     // that can be explicitely ignored in debugger's exception settings. 
     // If we'd just throw new Error() here, IE's debugger's exception settings 
     // will just consider it as "exception thrown by javascript code" which is 
     // something you wouldn't want it to ignore. 
     getErrorWithStack.arguments; 
     throw new Error(); // Fallback if above line don't throw. 
    } catch(e) { 
     return e; 
    } 
    return new Error(); 
} 
+0

感謝您的解釋,這是非常helful :) –