MCPcopy Index your code
hub / github.com/pyscript/pyscript / fetchSource

Function fetchSource

core/src/core.js:131–148  ·  view source on GitHub ↗
(tag, io, asText)

Source from the content-addressed store, hash-verified

129 * content as source.
130 */
131 const fetchSource = async (tag, io, asText) => {
132 if (tag.hasAttribute("src")) {
133 try {
134 return await fetch(tag.getAttribute("src")).then(getText);
135 } catch (error) {
136 io.stderr(error);
137 }
138 }
139
140 if (asText) return dedent(tag.textContent);
141
142 const code = dedent(unescape(tag.innerHTML));
143 console.warn(
144 `Deprecated: use <script type="${TYPE}"> for an always safe content parsing:\n`,
145 code,
146 );
147 return code;
148 };
149
150 // register once any interpreter
151 let alreadyRegistered = false;

Callers 2

onReadyFunction · 0.85
connectedCallbackMethod · 0.85

Calls 2

warnMethod · 0.80
fetchFunction · 0.50

Tested by

no test coverage detected