feat(app): hardware back button support

This commit is contained in:
Manu Mtz.-Almeida
2018-09-03 00:31:21 +02:00
parent d40d0a706f
commit dfac9dc4e9
9 changed files with 82 additions and 10 deletions

View File

@ -9,6 +9,14 @@ export function reorderArray(array: any[], indexes: {from: number, to: number}):
return array;
}
export function rIC(callback: () => void) {
if ('requestIdleCallback' in window) {
(window as any).requestIdleCallback(callback);
} else {
setTimeout(callback, 32);
}
}
export function hasShadowDom(el: HTMLElement) {
return !!el.shadowRoot && !!(el as any).attachShadow;
}