feature(routing): create external router controller for reconciling state from router in re-useable fashion

* external router controller

* external router controller

* gif it's working
This commit is contained in:
Dan Bucholtz
2018-02-13 01:28:39 -06:00
committed by GitHub
parent 529148e163
commit 4271a0fc1e
11 changed files with 464 additions and 419 deletions

View File

@@ -25,3 +25,13 @@ export function removeAllNodeChildren(element: HTMLElement) {
export function isString(something: any) {
return typeof something === 'string' ? true : false;
}
export function ensureExternalRounterController(): Promise<HTMLIonExternalRouterControllerElement> {
const element = document.querySelector('ion-external-router-controller');
if (element) {
return (element as any).componentOnReady();
}
const toCreate = document.createElement('ion-external-router-controller');
document.body.appendChild(toCreate);
return (toCreate as any).componentOnReady();
}