Quellcode durchsuchen

feat(twa) add TWA check function

dev1
Tudor-Ovidiu Avram vor 5 Jahren
Ursprung
Commit
a6100fa021
2 geänderte Dateien mit 10 neuen und 0 gelöschten Zeilen
  1. 1
    0
      .gitignore
  2. 9
    0
      modules/browser/BrowserCapabilities.js

+ 1
- 0
.gitignore Datei anzeigen

@@ -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 Datei anzeigen

@@ -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
      *

Laden…
Abbrechen
Speichern