package.esm2022.animations.async.src.providers.mjs Maven / Gradle / Ivy
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { DOCUMENT } from '@angular/common';
import { ANIMATION_MODULE_TYPE, makeEnvironmentProviders, NgZone, RendererFactory2, ɵperformanceMarkFeature as performanceMarkFeature, } from '@angular/core';
import { ɵDomRendererFactory2 as DomRendererFactory2 } from '@angular/platform-browser';
import { AsyncAnimationRendererFactory } from './async_animation_renderer';
/**
* Returns the set of dependency-injection providers
* to enable animations in an application. See [animations guide](guide/animations)
* to learn more about animations in Angular.
*
* When you use this function instead of the eager `provideAnimations()`, animations won't be
* rendered until the renderer is loaded.
*
* @usageNotes
*
* The function is useful when you want to enable animations in an application
* bootstrapped using the `bootstrapApplication` function. In this scenario there
* is no need to import the `BrowserAnimationsModule` NgModule at all, just add
* providers returned by this function to the `providers` list as show below.
*
* ```typescript
* bootstrapApplication(RootComponent, {
* providers: [
* provideAnimationsAsync()
* ]
* });
* ```
*
* @param type pass `'noop'` as argument to disable animations.
*
* @publicApi
*/
export function provideAnimationsAsync(type = 'animations') {
performanceMarkFeature('NgAsyncAnimations');
return makeEnvironmentProviders([
{
provide: RendererFactory2,
useFactory: (doc, renderer, zone) => {
return new AsyncAnimationRendererFactory(doc, renderer, zone, type);
},
deps: [DOCUMENT, DomRendererFactory2, NgZone],
},
{
provide: ANIMATION_MODULE_TYPE,
useValue: type === 'noop' ? 'NoopAnimations' : 'BrowserAnimations',
},
]);
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmlkZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcGxhdGZvcm0tYnJvd3Nlci9hbmltYXRpb25zL2FzeW5jL3NyYy9wcm92aWRlcnMudHMiXSwibmFtZXMiOltdLCJtYXB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