MCPcopy Index your code
hub / github.com/microsoft/SandDance / handleRawText

Function handleRawText

packages/sanddance-explorer/src/dataLoader.ts:15–41  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

13 const loader = vega.loader();
14
15 function handleRawText(text: string) {
16 let data: object[];
17 try {
18 data = vega.read(text, { type: dataFile.type, parse: {} });
19 }
20 catch (e) {
21 reject(e);
22 }
23 if (data) {
24 loadDataArray(data, dataFile.type).then(dc => {
25 if (dataFile.snapshotsUrl) {
26 fetch(dataFile.snapshotsUrl)
27 .then(response => response.json())
28 .then(snapshots => {
29 dc.snapshots = snapshots;
30 resolve(dc);
31 })
32 .catch(reject);
33 } else if (dataFile.snapshots) {
34 dc.snapshots = dataFile.snapshots;
35 resolve(dc);
36 } else {
37 resolve(dc);
38 }
39 }).catch(reject);
40 }
41 }
42
43 if (dataFile.dataUrl) {
44 loader.load(dataFile.dataUrl).then(handleRawText).catch(reject);

Callers 1

loadDataFileFunction · 0.70

Calls 3

rejectFunction · 0.85
loadDataArrayFunction · 0.70
resolveFunction · 0.50

Tested by

no test coverage detected