* restoreBackup * Restore the user's backup from localStorage. * This happens when: * - The user chooses to "Restore my changes" from the restore screen
()
| 1210 | * - The user chooses to "Restore my changes" from the restore screen |
| 1211 | */ |
| 1212 | restoreBackup() { |
| 1213 | this._canRestoreBackup = false; |
| 1214 | |
| 1215 | if (!this._mutex.locked()) return; // another browser tab owns the history |
| 1216 | |
| 1217 | const context = this.context; |
| 1218 | const storage = context.systems.storage; |
| 1219 | const json = storage.getItem(this._backupKey()); |
| 1220 | if (json) { |
| 1221 | context.resetAsync() |
| 1222 | .then(() => this.fromJSONAsync(json)); |
| 1223 | } |
| 1224 | } |
| 1225 | |
| 1226 | |
| 1227 | /** |
no test coverage detected