MCPcopy Index your code
hub / github.com/MagicMirrorOrg/MagicMirror / updateModuleContent

Function updateModuleContent

js/main.js:218–235  ·  view source on GitHub ↗

* Update the content of a module on screen. * @param {Module} module The module to check. * @param {string} newHeader The new header that is generated. * @param {HTMLElement} newContent The new content that is generated.

(module, newHeader, newContent)

Source from the content-addressed store, hash-verified

216 * @param {HTMLElement} newContent The new content that is generated.
217 */
218function updateModuleContent (module, newHeader, newContent) {
219 const moduleWrapper = document.getElementById(module.identifier);
220 if (moduleWrapper === null) {
221 return;
222 }
223 const headerWrapper = moduleWrapper.getElementsByClassName("module-header");
224 const contentWrapper = moduleWrapper.getElementsByClassName("module-content");
225
226 contentWrapper[0].innerHTML = "";
227 contentWrapper[0].appendChild(newContent);
228
229 headerWrapper[0].innerHTML = newHeader;
230 if (headerWrapper.length > 0 && newHeader) {
231 headerWrapper[0].style.display = "block";
232 } else {
233 headerWrapper[0].style.display = "none";
234 }
235}
236
237/**
238 * Hide the module.

Callers 1

updateDomWithContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected