Home / File/ events.ts — astro Source File

events.ts — astro Source File

Architecture documentation for events.ts, a typescript file in the astro codebase. 2 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 2 imports 7 functions 3 classes

Entity Profile

Dependency Diagram

graph LR
  75c59a6f_ee5d_6669_2750_97d28d913e90["events.ts"]
  4d9d07b9_627f_6a05_3aae_2cf1418e53a8["./swap-functions.js"]
  75c59a6f_ee5d_6669_2750_97d28d913e90 --> 4d9d07b9_627f_6a05_3aae_2cf1418e53a8
  af0fc1f4_1b53_7159_e40a_c13f7f62570b["./types.js"]
  75c59a6f_ee5d_6669_2750_97d28d913e90 --> af0fc1f4_1b53_7159_e40a_c13f7f62570b
  style 75c59a6f_ee5d_6669_2750_97d28d913e90 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { swap } from './swap-functions.js';
import type { Direction, NavigationTypeString } from './types.js';

/** @deprecated This will be removed in Astro 7 */
export const TRANSITION_BEFORE_PREPARATION = 'astro:before-preparation';
/** @deprecated This will be removed in Astro 7 */
export const TRANSITION_AFTER_PREPARATION = 'astro:after-preparation';
/** @deprecated This will be removed in Astro 7 */
export const TRANSITION_BEFORE_SWAP = 'astro:before-swap';
/** @deprecated This will be removed in Astro 7 */
export const TRANSITION_AFTER_SWAP = 'astro:after-swap';
/** @deprecated This will be removed in Astro 7 */
export const TRANSITION_PAGE_LOAD = 'astro:page-load';

type Events =
	| typeof TRANSITION_AFTER_PREPARATION
	| typeof TRANSITION_AFTER_SWAP
	| typeof TRANSITION_PAGE_LOAD;
export const triggerEvent = (name: Events) => document.dispatchEvent(new Event(name));
export const onPageLoad = () => triggerEvent(TRANSITION_PAGE_LOAD);

/*
 * Common stuff
 */
class BeforeEvent extends Event {
	readonly from: URL;
	to: URL;
	direction: Direction | string;
	readonly navigationType: NavigationTypeString;
	readonly sourceElement: Element | undefined;
	readonly info: any;
	newDocument: Document;
	readonly signal: AbortSignal;

	constructor(
		type: string,
		eventInitDict: EventInit | undefined,
		from: URL,
		to: URL,
		direction: Direction | string,
		navigationType: NavigationTypeString,
		sourceElement: Element | undefined,
		info: any,
		newDocument: Document,
		signal: AbortSignal,
	) {
		super(type, eventInitDict);
		this.from = from;
		this.to = to;
		this.direction = direction;
		this.navigationType = navigationType;
		this.sourceElement = sourceElement;
		this.info = info;
		this.newDocument = newDocument;
		this.signal = signal;

		Object.defineProperties(this, {
			from: { enumerable: true },
			to: { enumerable: true, writable: true },
			direction: { enumerable: true, writable: true },
// ... (148 more lines)

Domain

Subdomains

Types

Dependencies

  • ./swap-functions.js
  • ./types.js

Frequently Asked Questions

What does events.ts do?
events.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in events.ts?
events.ts defines 7 function(s): doPreparation, doSwap, isTransitionBeforePreparationEvent, isTransitionBeforeSwapEvent, onPageLoad, triggerEvent, updateScrollPosition.
What does events.ts depend on?
events.ts imports 2 module(s): ./swap-functions.js, ./types.js.
Where is events.ts in the architecture?
events.ts is located at packages/astro/src/transitions/events.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/transitions).

Analyze Your Own Codebase

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

Try Supermodel Free