From 712630ca65b8b083249bc7ab786046dc45622207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Wed, 17 May 2017 14:53:12 -0700 Subject: [PATCH] perf(animations): reduce size of animations bundle before: animations.umd.js = 33k animations.umd.min.js = 9.0k after: animations.umd.js = 31k animations.umd.min.js = 7.9k --- .../src/players/animation_player.ts | 33 +++++++++---------- .../animations/animations.d.ts | 28 ++++++++-------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/packages/animations/src/players/animation_player.ts b/packages/animations/src/players/animation_player.ts index 0906f7543d..2bb971949e 100644 --- a/packages/animations/src/players/animation_player.ts +++ b/packages/animations/src/players/animation_player.ts @@ -10,23 +10,22 @@ import {scheduleMicroTask} from '../util'; /** * @experimental Animation support is experimental. */ -export abstract class AnimationPlayer { - abstract onDone(fn: () => void): void; - abstract onStart(fn: () => void): void; - abstract onDestroy(fn: () => void): void; - abstract init(): void; - abstract hasStarted(): boolean; - abstract play(): void; - abstract pause(): void; - abstract restart(): void; - abstract finish(): void; - abstract destroy(): void; - abstract reset(): void; - abstract setPosition(p: any /** TODO #9100 */): void; - abstract getPosition(): number; - get parentPlayer(): AnimationPlayer|null { throw new Error('NOT IMPLEMENTED: Base Class'); } - set parentPlayer(player: AnimationPlayer|null) { throw new Error('NOT IMPLEMENTED: Base Class'); } - get totalTime(): number { throw new Error('NOT IMPLEMENTED: Base Class'); } +export interface AnimationPlayer { + onDone(fn: () => void): void; + onStart(fn: () => void): void; + onDestroy(fn: () => void): void; + init(): void; + hasStarted(): boolean; + play(): void; + pause(): void; + restart(): void; + finish(): void; + destroy(): void; + reset(): void; + setPosition(p: any /** TODO #9100 */): void; + getPosition(): number; + parentPlayer: AnimationPlayer|null; + readonly totalTime: number; beforeDestroy?: () => any; } diff --git a/tools/public_api_guard/animations/animations.d.ts b/tools/public_api_guard/animations/animations.d.ts index 034fcb87de..b0bae4d58a 100644 --- a/tools/public_api_guard/animations/animations.d.ts +++ b/tools/public_api_guard/animations/animations.d.ts @@ -98,23 +98,23 @@ export interface AnimationOptions { } /** @experimental */ -export declare abstract class AnimationPlayer { +export interface AnimationPlayer { beforeDestroy?: () => any; parentPlayer: AnimationPlayer | null; readonly totalTime: number; - abstract destroy(): void; - abstract finish(): void; - abstract getPosition(): number; - abstract hasStarted(): boolean; - abstract init(): void; - abstract onDestroy(fn: () => void): void; - abstract onDone(fn: () => void): void; - abstract onStart(fn: () => void): void; - abstract pause(): void; - abstract play(): void; - abstract reset(): void; - abstract restart(): void; - abstract setPosition(p: any): void; + destroy(): void; + finish(): void; + getPosition(): number; + hasStarted(): boolean; + init(): void; + onDestroy(fn: () => void): void; + onDone(fn: () => void): void; + onStart(fn: () => void): void; + pause(): void; + play(): void; + reset(): void; + restart(): void; + setPosition(p: any): void; } /** @experimental */