refactor(alert): update alert api

* alert poc

* refactor(app): add in app public api

* refactor(nav): implement a public interface and correct types to nav

* feature(helpers): promisify the animation's play method to make it play nicely with promise flows

* test(alert): fix test to ensure alert element is hydrated before using it

* refactor(index): expose the Nav public api types
This commit is contained in:
Dan Bucholtz
2017-11-20 15:51:20 -06:00
committed by GitHub
parent 5c214c3c46
commit ea003350b8
8 changed files with 157 additions and 116 deletions

View File

@ -1,4 +1,4 @@
import { StencilElement } from '..';
import { Animation, StencilElement } from '../index';
export function clamp(min: number, n: number, max: number) {
return Math.max(min, Math.min(n, max));
@ -266,3 +266,12 @@ export function reorderArray(array: any[], indexes: {from: number, to: number}):
array.splice(indexes.to, 0, element);
return array;
}
export function playAnimationAsync(animation: Animation): Promise<Animation> {
return new Promise((resolve) => {
animation.onFinish((ani: Animation) => {
resolve(ani);
});
animation.play();
});
}