Home / Function/ toggleAppStatus() — astro Function Reference

toggleAppStatus() — astro Function Reference

Architecture documentation for the toggleAppStatus() function in toolbar.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  8bc52765_9660_aff0_d7e3_374e4e252973["toggleAppStatus()"]
  833f7e6d_4781_eb37_c633_27829bbb8361["AstroDevToolbar"]
  8bc52765_9660_aff0_d7e3_374e4e252973 -->|defined in| 833f7e6d_4781_eb37_c633_27829bbb8361
  9028096c_54ca_ca1e_b2cb_f6201ef5a538["attachEvents()"]
  9028096c_54ca_ca1e_b2cb_f6201ef5a538 -->|calls| 8bc52765_9660_aff0_d7e3_374e4e252973
  efc01d18_85ec_e25d_5ba4_8115b21ae4ec["getActiveApp()"]
  8bc52765_9660_aff0_d7e3_374e4e252973 -->|calls| efc01d18_85ec_e25d_5ba4_8115b21ae4ec
  b54bc602_4007_3efe_883b_8c7b5af995e9["setAppStatus()"]
  8bc52765_9660_aff0_d7e3_374e4e252973 -->|calls| b54bc602_4007_3efe_883b_8c7b5af995e9
  style 8bc52765_9660_aff0_d7e3_374e4e252973 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/client/dev-toolbar/toolbar.ts lines 439–464

	async toggleAppStatus(app: DevToolbarApp) {
		const activeApp = this.getActiveApp();
		if (activeApp) {
			const closeApp = await this.setAppStatus(activeApp, false);

			// If the app returned false, don't open the new app, the old app didn't want to close
			if (!closeApp) return;
		}

		// TODO(fks): Handle a app that hasn't loaded yet.
		// Currently, this will just do nothing.
		if (app.status !== 'ready') return;

		// Open the selected app. If the selected app was
		// already the active app then the desired outcome
		// was to close that app, so no action needed.
		if (app !== activeApp) {
			await this.setAppStatus(app, true);

			if (import.meta.hot && app.id !== 'astro:more') {
				import.meta.hot.send('astro:devtoolbar:app:toggled', {
					app: app,
				});
			}
		}
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does toggleAppStatus() do?
toggleAppStatus() is a function in the astro codebase, defined in packages/astro/src/runtime/client/dev-toolbar/toolbar.ts.
Where is toggleAppStatus() defined?
toggleAppStatus() is defined in packages/astro/src/runtime/client/dev-toolbar/toolbar.ts at line 439.
What does toggleAppStatus() call?
toggleAppStatus() calls 2 function(s): getActiveApp, setAppStatus.
What calls toggleAppStatus()?
toggleAppStatus() is called by 1 function(s): attachEvents.

Analyze Your Own Codebase

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

Try Supermodel Free