IndexedDB - Do errors bubble all the way to IDBOpenDBRequest?

好久不见. 提交于 2020-01-24 22:58:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!