MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / loadStyle

Function loadStyle

data/loader.js:37–54  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

35 }
36
37 function loadStyle(file) {
38 return new Promise(function(resolve) {
39 let css = document.createElement("link");
40 css.rel = "stylesheet";
41 css.href = function() {
42 if ("undefined" != typeof EJS_paths && typeof EJS_paths[file] === "string") {
43 return EJS_paths[file];
44 } else {
45 return scriptPath + file;
46 }
47 }();
48 css.onload = resolve;
49 css.onerror = () => {
50 filesmissing(file).then(e => resolve());
51 }
52 document.head.appendChild(css);
53 })
54 }
55
56 async function filesmissing(file) {
57 console.error("Failed to load " + file);

Callers 2

filesmissingFunction · 0.85
loader.jsFile · 0.85

Calls 2

filesmissingFunction · 0.85
createElementMethod · 0.80

Tested by

no test coverage detected