From fbdb35b4e96466f376e28f9d05b5d5da86dafbd1 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Fri, 10 Jun 2016 10:21:01 -0700 Subject: [PATCH] fix: resolve errors w/ Closure Compiler. (#659) --- src/components/icon/icon.ts | 2 +- .../progress-circle/progress-circle.ts | 4 +-- src/core/errors/error.ts | 2 +- src/core/overlay/overlay-directives.ts | 35 ++++++++++--------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/components/icon/icon.ts b/src/components/icon/icon.ts index fcb867ff1c7a..a21974a608b8 100644 --- a/src/components/icon/icon.ts +++ b/src/components/icon/icon.ts @@ -18,7 +18,7 @@ export {MdIconRegistry} from './icon-registry'; /** Exception thrown when an invalid icon name is passed to an md-icon component. */ export class MdIconInvalidNameError extends MdError { constructor(iconName: string) { - super(`Invalid icon name: "${name}"`); + super(`Invalid icon name: "${iconName}"`); } } diff --git a/src/components/progress-circle/progress-circle.ts b/src/components/progress-circle/progress-circle.ts index 2a32e005f267..314bd4707ae6 100644 --- a/src/components/progress-circle/progress-circle.ts +++ b/src/components/progress-circle/progress-circle.ts @@ -251,8 +251,8 @@ function clamp(v: number) { * Returns the current timestamp either based on the performance global or a date object. */ function now() { - if (typeof performance !== 'undefined' && performance.now) { - return performance.now(); + if (window.performance && window.performance.now) { + return window.performance.now(); } return Date.now(); } diff --git a/src/core/errors/error.ts b/src/core/errors/error.ts index d24aa3047830..148a4745d38c 100644 --- a/src/core/errors/error.ts +++ b/src/core/errors/error.ts @@ -6,6 +6,6 @@ export class MdError extends Error { constructor(value: string) { super(); - super.message = value; + this.message = value; } } diff --git a/src/core/overlay/overlay-directives.ts b/src/core/overlay/overlay-directives.ts index 7f33576aa55a..e31c9e8675d1 100644 --- a/src/core/overlay/overlay-directives.ts +++ b/src/core/overlay/overlay-directives.ts @@ -24,6 +24,24 @@ let defaultPositionList = [ ]; +/** + * Directive applied to an element to make it usable as an origin for an Overlay using a + * ConnectedPositionStrategy. + */ +@Directive({ + selector: '[overlay-origin]', + exportAs: 'overlayOrigin', +}) +export class OverlayOrigin { + constructor(private _elementRef: ElementRef) { } + + get elementRef() { + return this._elementRef; + } +} + + + /** * Directive to facilitate declarative creation of an Overlay using a ConnectedPositionStrategy. */ @@ -86,21 +104,4 @@ export class ConnectedOverlayDirective implements OnInit, OnDestroy { } -/** - * Directive applied to an element to make it usable as an origin for an Overlay using a - * ConnectedPositionStrategy. - */ -@Directive({ - selector: '[overlay-origin]', - exportAs: 'overlayOrigin', -}) -export class OverlayOrigin { - constructor(private _elementRef: ElementRef) { } - - get elementRef() { - return this._elementRef; - } -} - - export const OVERLAY_DIRECTIVES = [ConnectedOverlayDirective, OverlayOrigin];