fix(menu): allow ssr to work properly with hardware back button updates (#20629)

This commit is contained in:
Liam DeBeasi
2020-02-26 15:54:50 -05:00
committed by GitHub
parent 11d8c14d72
commit fe8d74d08c

View File

@ -207,8 +207,9 @@ const createMenuController = () => {
registerAnimation('push', menuPushAnimation);
registerAnimation('overlay', menuOverlayAnimation);
const doc: Document = document;
doc.addEventListener('ionBackButton', (ev: any) => {
/* tslint:disable-next-line */
if (typeof document !== 'undefined') {
document.addEventListener('ionBackButton', (ev: any) => {
const openMenu = _getOpenSync();
if (openMenu) {
(ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => {
@ -216,6 +217,7 @@ const createMenuController = () => {
});
}
});
}
return {
registerAnimation,