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

Method constructor

src/components/WebComponents/wcPage.js:269–293  ·  view source on GitHub ↗

* * @param {HTMLElement} $el

($el)

Source from the content-addressed store, hash-verified

267 * @param {HTMLElement} $el
268 */
269 constructor($el) {
270 this.$el = $el;
271
272 this.onhide = this.onhide.bind(this);
273 this.onshow = this.onshow.bind(this);
274
275 this.$replacement = <span className="page-replacement"></span>;
276 this.$replacement.handler = this;
277
278 this.$el.on("hide", this.onhide);
279 this.$el.on("show", this.onshow);
280
281 // Cache scroll position on scroll event to prevent synchronous layout reading (forced reflow) during page transitions
282 this.$el.addEventListener(
283 "scroll",
284 (e) => {
285 const $body = this.$el.body;
286 if ($body && e.target === $body) {
287 this.scrollLeft = $body.scrollLeft;
288 this.scrollTop = $body.scrollTop;
289 }
290 },
291 { capture: true, passive: true },
292 );
293 }
294
295 /**
296 * Replace current element with a replacement element

Callers

nothing calls this directly

Calls 1

onMethod · 0.45

Tested by

no test coverage detected