소스 검색

feat(twa) add TWA check function

dev1
Tudor-Ovidiu Avram 5 년 전
부모
커밋
a6100fa021
2개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 1
    0
      .gitignore
  2. 9
    0
      modules/browser/BrowserCapabilities.js

+ 1
- 0
.gitignore 파일 보기

@@ -12,3 +12,4 @@ npm-*.log
12 12
 .jshintrc
13 13
 .DS_Store
14 14
 stats.json
15
+.vscode

+ 9
- 0
modules/browser/BrowserCapabilities.js 파일 보기

@@ -61,6 +61,15 @@ export default class BrowserCapabilities extends BrowserDetection {
61 61
             || this.isOpera();
62 62
     }
63 63
 
64
+    /**
65
+     * Checks whether current running context is a Trusted Web Application.
66
+     *
67
+     * @returns {boolean} Whether the current context is a TWA.
68
+     */
69
+    isTwa() {
70
+        return 'matchMedia' in window && window.matchMedia('(display-mode:standalone)').matches;
71
+    }
72
+
64 73
     /**
65 74
      * Checks if the current browser is supported.
66 75
      *

Loading…
취소
저장