perf(animations): use `ngDevMode` to tree-shake warning (#39964) · angular/angular@72aad32
@@ -21,7 +21,6 @@ const TAB_SPACE = ' ';
2121export class CssKeyframesDriver implements AnimationDriver {
2222private _count = 0;
2323private readonly _head: any = document.querySelector('head');
24-private _warningIssued = false;
25242625validateStyleProperty(prop: string): boolean {
2726return validateStyleProperty(prop);
@@ -79,8 +78,8 @@ export class CssKeyframesDriver implements AnimationDriver {
7978animate(
8079element: any, keyframes: ɵStyleData[], duration: number, delay: number, easing: string,
8180previousPlayers: AnimationPlayer[] = [], scrubberAccessRequested?: boolean): AnimationPlayer {
82-if (scrubberAccessRequested) {
83-this._notifyFaultyScrubber();
81+if ((typeof ngDevMode === 'undefined' || ngDevMode) && scrubberAccessRequested) {
82+notifyFaultyScrubber();
8483}
85848685const previousCssKeyframePlayers = <CssKeyframesPlayer[]>previousPlayers.filter(
@@ -117,15 +116,6 @@ export class CssKeyframesDriver implements AnimationDriver {
117116player.onDestroy(() => removeElement(kfElm));
118117return player;
119118}
120-121-private _notifyFaultyScrubber() {
122-if (!this._warningIssued) {
123-console.warn(
124-'@angular/animations: please load the web-animations.js polyfill to allow programmatic access...\n',
125-' visit https://bit.ly/IWukam to learn more about using the web-animation-js polyfill.');
126-this._warningIssued = true;
127-}
128-}
129119}
130120131121function flattenKeyframesIntoStyles(keyframes: null|{[key: string]: any}|
@@ -146,3 +136,12 @@ function flattenKeyframesIntoStyles(keyframes: null|{[key: string]: any}|
146136function removeElement(node: any) {
147137node.parentNode.removeChild(node);
148138}
139+140+let warningIssued = false;
141+function notifyFaultyScrubber(): void {
142+if (warningIssued) return;
143+console.warn(
144+'@angular/animations: please load the web-animations.js polyfill to allow programmatic access...\n',
145+' visit https://bit.ly/IWukam to learn more about using the web-animation-js polyfill.');
146+warningIssued = true;
147+}