MCPcopy Create free account
hub / github.com/facebook/Rapid / restoreBackup

Method restoreBackup

modules/core/EditSystem.js:1212–1224  ·  view source on GitHub ↗

* restoreBackup * Restore the user's backup from localStorage. * This happens when: * - The user chooses to "Restore my changes" from the restore screen

()

Source from the content-addressed store, hash-verified

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 /**

Callers 1

uiRestoreFunction · 0.80

Calls 5

_backupKeyMethod · 0.95
fromJSONAsyncMethod · 0.95
lockedMethod · 0.80
getItemMethod · 0.45
resetAsyncMethod · 0.45

Tested by

no test coverage detected