MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / scriptLoader

Function scriptLoader

client/src/utils/script-loaders.ts:1–16  ·  view source on GitHub ↗
(
  id: string,
  async: boolean,
  src: string,
  onload: (() => void) | null,
  text: string
)

Source from the content-addressed store, hash-verified

1export function scriptLoader(
2 id: string,
3 async: boolean,
4 src: string,
5 onload: (() => void) | null,
6 text: string
7): void {
8 const s = document.createElement('script');
9 s.type = 'text/javascript';
10 s.id = id;
11 s.async = async;
12 s.onload = onload;
13 s.src = src;
14 s.text = text;
15 document.getElementsByTagName('head')[0].appendChild(s);
16}
17
18export function scriptRemover(id: string): void {
19 const script = document.getElementById(id);

Callers 2

loadScriptMethod · 0.90
mathJaxScriptLoaderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected