mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(overlays): OverlayController interface
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
|
||||
import { proxyMethod } from '../util/util';
|
||||
|
||||
|
||||
export class OverlayBaseController<Opts, Overlay> {
|
||||
constructor(private ctrl: string) {}
|
||||
|
||||
@ -12,4 +10,8 @@ export class OverlayBaseController<Opts, Overlay> {
|
||||
dismiss(data?: any, role?: string, id = -1): Promise<void> {
|
||||
return proxyMethod(this.ctrl, 'dismiss', data, role, id);
|
||||
}
|
||||
|
||||
getTop(): Promise<Overlay> {
|
||||
return proxyMethod(this.ctrl, 'getTop');
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
|
||||
|
||||
|
||||
export function proxyMethod(ctrlName: string, methodName: string, ...args: any[]) {
|
||||
const controller = ensureElementInBody(ctrlName);
|
||||
return controller.componentOnReady()
|
||||
@ -15,18 +13,3 @@ export function ensureElementInBody(elementName: string) {
|
||||
}
|
||||
return element as HTMLStencilElement;
|
||||
}
|
||||
|
||||
export function removeAllNodeChildren(element: HTMLElement) {
|
||||
while (element.firstChild) {
|
||||
element.removeChild(element.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
export function isString(something: any) {
|
||||
return typeof something === 'string' ? true : false;
|
||||
}
|
||||
|
||||
export function getIonApp(): Promise<HTMLIonAppElement> {
|
||||
const element = ensureElementInBody('ion-app') as HTMLIonAppElement;
|
||||
return element.componentOnReady();
|
||||
}
|
||||
|
Reference in New Issue
Block a user