MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / updateStorage

Function updateStorage

src/pages/fileBrowser/fileBrowser.js:1586–1604  ·  view source on GitHub ↗

* * @param {Storage} storage * @param {Boolean} doesReload

(storage, doesReload = true)

Source from the content-addressed store, hash-verified

1584 * @param {Boolean} doesReload
1585 */
1586 function updateStorage(storage, doesReload = true) {
1587 if (storage.uuid) {
1588 storageList = storageList.filter((s) => s.uuid !== storage.uuid);
1589 } else {
1590 storage.uuid = helpers.uuid();
1591 }
1592
1593 if (!storage.type) {
1594 storage.type = "dir";
1595 }
1596
1597 if (!storage.storageType) {
1598 storage.storageType = storage.type;
1599 }
1600
1601 storageList.push(storage);
1602 localStorage.storageList = JSON.stringify(storageList);
1603 if (doesReload) reload();
1604 }
1605
1606 function render(dir) {
1607 const { list, scroll } = dir;

Callers 3

FileBrowserIncludeFunction · 0.85
handleClickFunction · 0.85
contextMenuHandlerFunction · 0.85

Calls 1

reloadFunction · 0.70

Tested by

no test coverage detected