mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 14:01:20 +08:00
refactor(): deprecate web component controllers (#19109)
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import { HTMLStencilElement } from '../types/interfaces';
|
||||
|
||||
declare const __zone_symbol__requestAnimationFrame: any;
|
||||
declare const requestAnimationFrame: any;
|
||||
@ -12,18 +11,3 @@ export const raf = (h: any) => {
|
||||
}
|
||||
return setTimeout(h);
|
||||
};
|
||||
|
||||
export const proxyMethod = (ctrlName: string, doc: Document, methodName: string, ...args: any[]) => {
|
||||
const controller = ensureElementInBody(ctrlName, doc);
|
||||
return controller.componentOnReady()
|
||||
.then(() => (controller as any)[methodName].apply(controller, args));
|
||||
};
|
||||
|
||||
export const ensureElementInBody = (elementName: string, doc: Document) => {
|
||||
let element = doc.querySelector(elementName);
|
||||
if (!element) {
|
||||
element = doc.createElement(elementName);
|
||||
doc.body.appendChild(element);
|
||||
}
|
||||
return element as HTMLStencilElement;
|
||||
};
|
||||
|
Reference in New Issue
Block a user