我一直无法找到列出我可以从返回到不同操作的事件对象onsuccess
或onerror
回调的事件对象中获得什么的信息。这个 Mozilla 文档是我找到的最详细的信息,但没有任何地方提到这一点。
例如:
var req = indexedDB.open( "mydb" );
req.onsuccess = function(evt)
{
//I know this only from examples, but how else can I know what
//evt.target.result would refer to? And what else is in evt?
var db = evt.target.result;
}
还有另一个“成功”回调:
var req = myObjectStore.add( someData );
req.onsuccess = function(evt)
{
//What does this refer to? What else is in the event object?
var whatIsThis = evt.target.result;
}