MCPcopy
hub / github.com/QwikDev/qwik / processReadyStateChange

Function processReadyStateChange

packages/qwik/src/qwikloader.ts:221–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

219};
220
221const processReadyStateChange = () => {
222 const readyState = doc.readyState;
223 if (!hasInitialized && (readyState == 'interactive' || readyState == 'complete')) {
224 roots.forEach(findShadowRoots);
225 // document is ready
226 hasInitialized = 1;
227
228 emitEvent('qinit');
229 const riC = win.requestIdleCallback ?? win.setTimeout;
230 riC.bind(win)(() => emitEvent('qidle'));
231
232 if (events.has('qvisible')) {
233 const results = querySelectorAll('[on\\:qvisible]');
234 const observer = new IntersectionObserver((entries) => {
235 for (const entry of entries) {
236 if (entry.isIntersecting) {
237 observer.unobserve(entry.target);
238 dispatch(entry.target, '', createEvent<QwikVisibleEvent>('qvisible', entry));
239 }
240 }
241 });
242 results.forEach((el) => observer.observe(el));
243 }
244 }
245};
246
247const addEventListener = (
248 el: EventTarget,

Callers 1

qwikloader.tsFile · 0.85

Calls 5

querySelectorAllFunction · 0.85
createEventFunction · 0.85
emitEventFunction · 0.70
dispatchFunction · 0.70
hasMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…