MCPcopy Create free account
hub / github.com/angular/components / _getAnimationsState

Function _getAnimationsState

src/material/core/animation/animation.ts:27–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 * @docs-private
26 */
27export function _getAnimationsState(): 'enabled' | 'di-disabled' | 'reduced-motion' {
28 if (
29 inject(MATERIAL_ANIMATIONS, {optional: true})?.animationsDisabled ||
30 inject(ANIMATION_MODULE_TYPE, {optional: true}) === 'NoopAnimations'
31 ) {
32 return 'di-disabled';
33 }
34
35 reducedMotion ??= inject(MediaMatcher).matchMedia('(prefers-reduced-motion)').matches;
36 return reducedMotion ? 'reduced-motion' : 'enabled';
37}
38
39/**
40 * Returns whether animations have been disabled by DI. Must be called in a DI context.

Callers 3

constructorMethod · 0.90
constructorMethod · 0.90
_animationsDisabledFunction · 0.85

Calls 1

matchMediaMethod · 0.45

Tested by

no test coverage detected