• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / luma.gl / 13874355088

15 Mar 2025 03:49PM UTC coverage: 75.241% (+0.2%) from 75.087%
13874355088

push

github

web-flow
chore(deps): bump @babel/runtime from 7.24.0 to 7.26.10 in /website (#2349)

Signed-off-by: dependabot[bot] <support@github.com>

2021 of 2649 branches covered (76.29%)

Branch coverage included in aggregate %.

26333 of 35035 relevant lines covered (75.16%)

50.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/modules/webgl/src/utils/load-script.ts
1
// luma.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4

1✔
5
/**
1✔
6
 * Load a script (identified by an url). When the url returns, the
1✔
7
 * content of this file is added into a new script element, attached to the DOM (body element)
1✔
8
 * @param scriptUrl defines the url of the script to laod
1✔
9
 * @param scriptId defines the id of the script element
1✔
10
 */
1✔
11
export async function loadScript(scriptUrl: string, scriptId?: string): Promise<Event> {
1✔
12
  const head = document.getElementsByTagName('head')[0];
1✔
13
  if (!head) {
1!
14
    throw new Error('loadScript');
×
15
  }
×
16

1✔
17
  const script = document.createElement('script');
1✔
18
  script.setAttribute('type', 'text/javascript');
1✔
19
  script.setAttribute('src', scriptUrl);
1✔
20
  if (scriptId) {
1!
21
    script.id = scriptId;
×
22
  }
×
23

1✔
24
  return new Promise((resolve, reject) => {
1✔
25
    script.onload = resolve;
1✔
26
    script.onerror = error =>
1✔
27
      reject(new Error(`Unable to load script '${scriptUrl}': ${error as string}`));
×
28
    head.appendChild(script);
1✔
29
  });
1✔
30
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc