MCPcopy Create free account
hub / github.com/react/react / loadScript

Function loadScript

fixtures/dom/public/renderer.js:126–139  ·  view source on GitHub ↗
(src)

Source from the content-addressed store, hash-verified

124 }
125
126 function loadScript(src) {
127 return new Promise(function (resolve, reject) {
128 var script = document.createElement('script');
129 script.async = true;
130 script.src = src;
131
132 script.onload = resolve;
133 script.onerror = function (error) {
134 reject(new Error('Unable to load ' + src));
135 };
136
137 document.body.appendChild(script);
138 });
139 }
140
141 function injectFixture(src) {
142 Fixture = new Function(src + '\nreturn Fixture;')();

Callers 1

renderer.jsFile · 0.70

Calls 1

rejectFunction · 0.50

Tested by

no test coverage detected