Home / Class/ ManualResetEvent Class — astro Architecture

ManualResetEvent Class — astro Architecture

Architecture documentation for the ManualResetEvent class in rendering.test.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  271f8d84_b6c9_ef7e_8f82_51cf97170259["ManualResetEvent"]
  e3fe003a_df56_8dae_828e_d1fb163c9c09["rendering.test.js"]
  271f8d84_b6c9_ef7e_8f82_51cf97170259 -->|defined in| e3fe003a_df56_8dae_828e_d1fb163c9c09
  508aaf09_d6ec_9187_f847_71a7bc449b34["release()"]
  271f8d84_b6c9_ef7e_8f82_51cf97170259 -->|method| 508aaf09_d6ec_9187_f847_71a7bc449b34
  180b1381_c14e_3309_b9a2_d05bc9e8a006["wait()"]
  271f8d84_b6c9_ef7e_8f82_51cf97170259 -->|method| 180b1381_c14e_3309_b9a2_d05bc9e8a006

Relationship Graph

Source Code

packages/astro/test/units/render/rendering.test.js lines 284–316

class ManualResetEvent {
	#resolve;
	#promise;
	#done = false;

	release() {
		if (this.#done) {
			return;
		}

		this.#done = true;

		if (this.#resolve) {
			this.#resolve();
		}
	}

	wait() {
		// Promise constructor callbacks are called immediately
		// so retrieving the value of "resolve" should
		// be safe to do.

		if (!this.#promise) {
			this.#promise = this.#done
				? Promise.resolve()
				: new Promise((resolve) => {
						this.#resolve = resolve;
					});
		}

		return this.#promise;
	}
}

Frequently Asked Questions

What is the ManualResetEvent class?
ManualResetEvent is a class in the astro codebase, defined in packages/astro/test/units/render/rendering.test.js.
Where is ManualResetEvent defined?
ManualResetEvent is defined in packages/astro/test/units/render/rendering.test.js at line 284.

Analyze Your Own Codebase

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

Try Supermodel Free