MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / restoreEl

Method restoreEl

src/components/WebComponents/wcPage.js:310–324  ·  view source on GitHub ↗

* Restore current element from a replacement element

()

Source from the content-addressed store, hash-verified

308 * Restore current element from a replacement element
309 */
310 restoreEl() {
311 if (this.$el.isConnected || !this.$replacement.isConnected) return;
312 if (typeof this.onRestore === "function") this.onRestore();
313 this.$el.off("hide", this.onhide);
314 this.$replacement.parentElement.replaceChild(this.$el, this.$replacement);
315 const { scrollLeft, scrollTop } = this;
316 requestAnimationFrame(() => {
317 const $body = this.$el.body;
318 if ($body) {
319 $body.scrollLeft = scrollLeft;
320 $body.scrollTop = scrollTop;
321 }
322 });
323 this.$el.on("hide", this.onhide);
324 }
325
326 onhide() {
327 this.$el.off("hide", this.onhide);

Callers 1

wcPage.jsFile · 0.80

Calls 2

offMethod · 0.80
onMethod · 0.45

Tested by

no test coverage detected