From 297e5ad5c9312342ba130512ce25d439c9df0a2c Mon Sep 17 00:00:00 2001 From: bnymncoskuner Date: Mon, 5 Apr 2021 15:41:39 +0300 Subject: [PATCH] refactor: only warn in devMode --- .../src/lib/components/modal/modal.component.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts index d11d1bcbc2..8452a951df 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts @@ -1,3 +1,4 @@ +import { isDevMode } from '@angular/core'; import { SubscriptionService } from '@abp/ng.core'; import { Component, @@ -206,9 +207,7 @@ export class ModalComponent implements OnDestroy { setTimeout(() => { if (!this.abpClose) return; - console.warn( - 'Please use abpClose directive instead of #abpClose template variable. #abpClose will be removed in v5.0', - ); + this.warnForDeprecatedClose(); fromEvent(this.abpClose.nativeElement, 'click') .pipe(takeUntil(this.destroy$)) .subscribe(() => this.close()); @@ -216,4 +215,12 @@ export class ModalComponent implements OnDestroy { this.init.emit(); } + + private warnForDeprecatedClose() { + if (isDevMode()) { + console.warn( + 'Please use abpClose directive instead of #abpClose template variable. #abpClose will be removed in v5.0', + ); + } + } }