web-manager 3.2.9 → 3.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/lib/utilities.js +24 -0
  2. package/package.json +1 -1
package/lib/utilities.js CHANGED
@@ -95,4 +95,28 @@ Utilities.escapeHTML = function (str) {
95
95
  });
96
96
  }
97
97
 
98
+ Utilities.getContext = function () {
99
+ // Check mobile
100
+ function mobile() {
101
+ try {
102
+ var m = navigator.userAgentData.mobile;
103
+ return typeof m === 'undefined' ? _THROW : m === true;
104
+ } catch (e) {
105
+ try {
106
+ // return window.matchMedia('only screen and (max-width: 767px)').matches;
107
+ return window.matchMedia('(max-width: 767px)').matches;
108
+ } catch (e) {
109
+ return false;
110
+ }
111
+ }
112
+ }
113
+
114
+ // Return findings
115
+ return {
116
+ client: {
117
+ mobile: mobile(),
118
+ },
119
+ }
120
+ }
121
+
98
122
  module.exports = Utilities;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "3.2.9",
3
+ "version": "3.2.11",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "index.js",
6
6
  "scripts": {