问题
I’m using indexedDB for the first time, and the mozilla documentation states that errors bubble all the way to the “database” instance.
It’s my understanding that event propagation in this system is entirely inherited from the DOM event model.
I’m curious if what is meant is that errors will bubble all the way to IDBOpenDBRequest (that which is instantiated with indexedDB.open()).
The documentation states that you can attach an onerror event handler to the top level IDB instances and it can intercept all your errors in one handler. This makes more sense to me if this is attached to IDBOpenDBRequest because it is truly at the highest level. However, the way it’s explained makes it sound like it’s actually IDBDatabase that is the end of the bubbling line?
回答1:
No. Events bubble from request (IDBRequest
) to transaction (IDBTransaction
) to connection (IDBDatabase
) - that's it.
Search in the spec for "get the parent" which is spec language for where the event bubbles.
来源:https://stackoverflow.com/questions/47584346/indexeddb-do-errors-bubble-all-the-way-to-idbopendbrequest