How to use the upad-parse/dist/index.js.parseAssets function in upad-parse

To help you get started, we’ve selected a few upad-parse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MicroPad / Web / src / webV3 / src / epics / NotepadEpics.ts View on Github external
return fromPromise(new Promise(resolve => {
				const notepad: INotepad = Parser.notepad;

				// Sort out assets
				Parser.parseAssets(action.payload, async (assets: IAssets) => {
					const notepadAssets = new Set((notepad.notepadAssets || []));
					for (let i = 0; i < assets.assets.length; i++) {
						if (!notepadAssets.has(assets.assets[i].uuid)) notepadAssets.add(assets.assets[i].uuid);
						await ASSET_STORAGE.setItem(assets.assets[i].uuid, assets.assets[i].data);
					}

					notepad.notepadAssets = Array.from(notepadAssets);
					resolve(notepad);
				});
			}));
		}),