MCPcopy Create free account
hub / github.com/RubyLouvre/anu / runScripts

Function runScripts

test/babel.js:60915–60937  ·  view source on GitHub ↗

* Find and run all script tags with type="text/jsx".

(transformFn)

Source from the content-addressed store, hash-verified

60913 * Find and run all script tags with type="text/jsx".
60914 */
60915 function runScripts(transformFn) {
60916 headEl = document.getElementsByTagName('head')[0];
60917 var scripts = document.getElementsByTagName('script');
60918
60919 // Array.prototype.slice cannot be used on NodeList on IE8
60920 var jsxScripts = [];
60921 for (var i = 0; i < scripts.length; i++) {
60922 var script = scripts.item(i);
60923 // Support the old type="text/jsx;harmony=true"
60924 var type = script.type.split(';')[0];
60925 if (scriptTypes.indexOf(type) !== -1) {
60926 jsxScripts.push(script);
60927 }
60928 }
60929
60930 if (jsxScripts.length === 0) {
60931 return;
60932 }
60933
60934 console.warn('You are using the in-browser Babel transformer. Be sure to precompile ' + 'your scripts for production - https://babeljs.io/docs/setup/');
60935
60936 loadScripts(transformFn, jsxScripts);
60937 }
60938
60939/***/ },
60940/* 618 */

Callers

nothing calls this directly

Calls 1

loadScriptsFunction · 0.85

Tested by

no test coverage detected