Utility to determine if client is PWA

Summary: This is currently used in multiple places, let's put it under utils.

Reviewed By: aigoncharov

Differential Revision: D50883125

fbshipit-source-id: ee161a035cd01ca73a2521f813c4b397aa647037
This commit is contained in:
Lorenzo Blasa
2023-11-01 11:15:17 -07:00
committed by Facebook GitHub Bot
parent 368dfc90f6
commit 08e742ceff
2 changed files with 14 additions and 0 deletions

View File

@@ -12,3 +12,5 @@ export {RenderHost, getRenderHostInstance} from 'flipper-frontend-core';
export {startFlipperDesktop} from './startFlipperDesktop'; export {startFlipperDesktop} from './startFlipperDesktop';
export {Icon} from './utils/icons'; export {Icon} from './utils/icons';
export {isPWA} from './utils/pwa';

View File

@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
export const isPWA = () => {
return window.matchMedia('(display-mode: standalone)').matches;
};