MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / un_src

Method un_src

tools/link.py:2797–2812  ·  view source on GitHub ↗

Use this if you want to modify the script and need it to be inline.

(self)

Source from the content-addressed store, hash-verified

2795 self.inline = None # if set, we have the contents of a script to write inline in a script
2796
2797 def un_src(self):
2798 """Use this if you want to modify the script and need it to be inline."""
2799 if self.src is None:
2800 return
2801 quoted_src = quote(self.src)
2802 if settings.EXPORT_ES6:
2803 self.inline = f'''
2804 import("./{quoted_src}").then(exports => exports.default(Module))
2805 '''
2806 else:
2807 self.inline = f'''
2808 var script = document.createElement('script');
2809 script.src = "{quoted_src}";
2810 document.body.appendChild(script);
2811 '''
2812 self.src = None
2813
2814 def replacement(self):
2815 """Return the script tag to replace the {{{ SCRIPT }}} tag in the target."""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected