使用 javascript 关闭 indexeddb 中的游标

Close a cursor in indexeddb with javascript

有没有办法关闭 indexeddb 中的所有游标? 我需要使用 javascript.

停止所有当前打开的游标

IndexedDB 具有事务模型,这意味着可以在事务范围内访问每个数据库对象,如 table、游标、索引。它们无法在事务外打开或访问。

Check this

IndexedDB is built on a transactional database model. Everything you do in IndexedDB always happens in the context of a transaction. The IndexedDB API provides lots of objects that represent indexes, tables, cursors, and so on, but each of these is tied to a particular transaction. Thus, you cannot execute commands or open cursors outside of a transaction.

因此,就像打开游标一样,只能从其事务上下文中关闭游标。因此,您不能通过单个 API 调用关闭 IndexedDB 上所有打开的游标。 IndexedDB 没有这样的 API。