MCPcopy
hub / github.com/MagicMirrorOrg/MagicMirror / _updateDom

Function _updateDom

js/main.js:121–143  ·  view source on GitHub ↗

* Update the dom for a specific module. * @param {Module} module The module that needs an update. * @param {object|number} [updateOptions] The (optional) number of microseconds for the animation or object with updateOptions (speed/animates) * @param {boolean} [createAnimatedDom] for displaying on

(module, updateOptions, createAnimatedDom = false)

Source from the content-addressed store, hash-verified

119 * @returns {Promise<void>} Resolved when the dom is fully updated.
120 */
121async function _updateDom (module, updateOptions, createAnimatedDom = false) {
122 let speed = updateOptions;
123 let animateOut = null;
124 let animateIn = null;
125 if (typeof updateOptions === "object") {
126 if (typeof updateOptions.options === "object" && updateOptions.options.speed !== undefined) {
127 speed = updateOptions.options.speed;
128 Log.debug(`updateDom: ${module.identifier} Has speed in object: ${speed}`);
129 if (typeof updateOptions.options.animate === "object") {
130 animateOut = updateOptions.options.animate.out;
131 animateIn = updateOptions.options.animate.in;
132 Log.debug(`updateDom: ${module.identifier} Has animate in object: out->${animateOut}, in->${animateIn}`);
133 }
134 } else {
135 Log.debug(`updateDom: ${module.identifier} Has no speed in object`);
136 speed = 0;
137 }
138 }
139
140 const newHeader = module.getHeader();
141 const newContent = await module.getDom();
142 await updateDomWithContent(module, speed, newHeader, newContent, animateOut, animateIn, createAnimatedDom);
143}
144
145/**
146 * Update the dom with the specified content

Callers 2

createModuleDomFunction · 0.85
updateDomFunction · 0.85

Calls 3

updateDomWithContentFunction · 0.85
getHeaderMethod · 0.80
getDomMethod · 0.80

Tested by

no test coverage detected