@arcblock/react-hooks 1.15.7 → 1.15.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/useBrowser.js +11 -14
- package/package.json +2 -2
package/lib/useBrowser.js
CHANGED
|
@@ -11,11 +11,17 @@ var _ismobilejs = _interopRequireDefault(require("ismobilejs"));
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
|
|
14
20
|
function useBrowser() {
|
|
15
|
-
const [browser
|
|
16
|
-
wallet:
|
|
17
|
-
wechat:
|
|
18
|
-
mobile: {
|
|
21
|
+
const [browser] = (0, _react.useState)({
|
|
22
|
+
wallet: navigator.userAgent.indexOf('ABTWallet') > -1,
|
|
23
|
+
wechat: /MicroMessenger/i.test(navigator.userAgent),
|
|
24
|
+
mobile: _objectSpread({
|
|
19
25
|
apple: {
|
|
20
26
|
phone: false,
|
|
21
27
|
ipod: false,
|
|
@@ -48,16 +54,7 @@ function useBrowser() {
|
|
|
48
54
|
phone: false,
|
|
49
55
|
tablet: false,
|
|
50
56
|
any: false
|
|
51
|
-
}
|
|
57
|
+
}, (0, _ismobilejs.default)(navigator.userAgent))
|
|
52
58
|
});
|
|
53
|
-
(0, _react.useEffect)(() => {
|
|
54
|
-
const isWallet = navigator.userAgent.indexOf('ABTWallet') > -1;
|
|
55
|
-
const isWechat = /MicroMessenger/i.test(navigator.userAgent);
|
|
56
|
-
setBrowser({
|
|
57
|
-
wallet: isWallet,
|
|
58
|
-
wechat: isWechat,
|
|
59
|
-
mobile: (0, _ismobilejs.default)(navigator.userAgent)
|
|
60
|
-
});
|
|
61
|
-
}, []);
|
|
62
59
|
return browser;
|
|
63
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/react-hooks",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.11",
|
|
4
4
|
"description": "React hooks used by arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
49
49
|
"jest": "^24.1.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "d3f501467f29cba123c8926f82124d71c578d404"
|
|
52
52
|
}
|