Quellcode durchsuchen

feat(twa) add TWA check function

release-8443
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
 .jshintrc
12
 .jshintrc
13
 .DS_Store
13
 .DS_Store
14
 stats.json
14
 stats.json
15
+.vscode

+ 9
- 0
modules/browser/BrowserCapabilities.js Datei anzeigen

61
             || this.isOpera();
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
      * Checks if the current browser is supported.
74
      * Checks if the current browser is supported.
66
      *
75
      *

Laden…
Abbrechen
Speichern