Update 6-data-storage/03-indexeddb/article.md
Co-authored-by: Muhammed Zakir <8190126+MuhammedZakir@users.noreply.github.com>
This commit is contained in:
parent
7b88ad9a9c
commit
d235632379
1 changed files with 1 additions and 1 deletions
|
@ -121,7 +121,7 @@ So there's a tab with an open connection to DB version `1`, while the second tab
|
|||
|
||||
The problem is that a database is shared between two tabs, as it's the same site, same origin. And it can't be both version `1` and `2`. To perform the update to version `2`, all connections to version 1 must be closed, including the one in the first tab.
|
||||
|
||||
In order to organize that, the `versionchange` event triggers on the "outdated" database object. We should listen for it and close the old database connection (and probably suggest the visitor reloads the page, to load the updated code).
|
||||
In order to organize that, the `versionchange` event triggers on the "outdated" database object. We should listen for it and close the old database connection (and probably suggest a page reload, to load the updated code).
|
||||
|
||||
If we don't listen for the `versionchange` event and don't close the old connection, then the second, new connection won't be made. The `openRequest` object will emit the `blocked` event instead of `success`. So the second tab won't work.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue