Home / Function/ initTapStrategy() — astro Function Reference

initTapStrategy() — astro Function Reference

Architecture documentation for the initTapStrategy() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  24714cbf_c269_c51b_a951_fe6138916c1c["initTapStrategy()"]
  315e53ea_6d34_137c_ce5c_8c89aca90db9["index.ts"]
  24714cbf_c269_c51b_a951_fe6138916c1c -->|defined in| 315e53ea_6d34_137c_ce5c_8c89aca90db9
  6ed5ea2f_503c_fb78_a8ee_5c3ea9f2de4f["init()"]
  6ed5ea2f_503c_fb78_a8ee_5c3ea9f2de4f -->|calls| 24714cbf_c269_c51b_a951_fe6138916c1c
  70bfc884_b3b0_e84b_4b73_06d369aade2b["elMatchesStrategy()"]
  24714cbf_c269_c51b_a951_fe6138916c1c -->|calls| 70bfc884_b3b0_e84b_4b73_06d369aade2b
  1502f987_7806_fcef_2f8e_55d799080686["prefetch()"]
  24714cbf_c269_c51b_a951_fe6138916c1c -->|calls| 1502f987_7806_fcef_2f8e_55d799080686
  style 24714cbf_c269_c51b_a951_fe6138916c1c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/prefetch/index.ts lines 57–69

function initTapStrategy() {
	for (const event of ['touchstart', 'mousedown']) {
		document.addEventListener(
			event,
			(e) => {
				if (elMatchesStrategy(e.target, 'tap')) {
					prefetch(e.target.href, { ignoreSlowConnection: true });
				}
			},
			{ passive: true },
		);
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does initTapStrategy() do?
initTapStrategy() is a function in the astro codebase, defined in packages/astro/src/prefetch/index.ts.
Where is initTapStrategy() defined?
initTapStrategy() is defined in packages/astro/src/prefetch/index.ts at line 57.
What does initTapStrategy() call?
initTapStrategy() calls 2 function(s): elMatchesStrategy, prefetch.
What calls initTapStrategy()?
initTapStrategy() is called by 1 function(s): init.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free