How do you keep an indexeddb transaction alive?

后端 未结 4 1651
暗喜
暗喜 2020-12-15 07:19

Instead of opening several transactions (read a table, write to a table, write to another table, etc) is it possible to do this all from a single transaction as long as you

4条回答
  •  一向
    一向 (楼主)
    2020-12-15 07:45

    Short answer: Don't keep.

    To prevent race condition, IndexedDB is designed for implicit commit and hence you must NOT explicitly keep an transaction alive. If it is required, change your algorithm so that it does not require to keep it alive.

    Reuse transaction for performance and executing ordered requests. In these cases, transaction will implicitly keep alive.

提交回复
热议问题