mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
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:
@ -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();
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user