[@babel/standalone] Remove additional function context (#7094)

This commit is contained in:
Steve Fan
2018-01-05 11:15:51 +08:00
committed by Brian Ng
parent aec6e5c370
commit 1ded1d7ff6
2 changed files with 25 additions and 6 deletions

View File

@@ -244,14 +244,14 @@ registerPresets({
export const version = VERSION;
function onDOMContentLoaded() {
transformScriptTags();
}
// Listen for load event if we're in a browser and then kick off finding and
// running of scripts with "text/babel" type.
if (typeof window !== "undefined" && window && window.addEventListener) {
window.addEventListener(
"DOMContentLoaded",
() => transformScriptTags(),
false,
);
window.addEventListener("DOMContentLoaded", onDOMContentLoaded, false);
}
/**
@@ -266,5 +266,5 @@ export function transformScriptTags(scriptTags) {
* Disables automatic transformation of <script> tags with "text/babel" type.
*/
export function disableScriptTags() {
window.removeEventListener("DOMContentLoaded", transformScriptTags);
window.removeEventListener("DOMContentLoaded", onDOMContentLoaded);
}