-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDEVICE_NETWORK.js
More file actions
41 lines (35 loc) · 965 Bytes
/
DEVICE_NETWORK.js
File metadata and controls
41 lines (35 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict';
// {
// code:0,
// response: {
// status: 0 //网络状态 0没网络 1移动网络 2wifi网络
// }
// }
/**
* todo DEVICE
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _config = require('./APP/config');
var name = 'DEVICE_NETWORK';
var DEVICE_NETWORK = function DEVICE_NETWORK() {
var fn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (_) {};
if (typeof fn === 'function') {
(0, _config.WinJSDec)(function (_) {
window.WinJSBridge.call('device', 'networkStatus', function (res) {
var code = res.code,
response = res.response;
if (code == 0) {
fn(response);
} else {
throw new Error('[' + name + '] ' + _config.appError);
}
});
});
} else {
throw new TypeError('[' + name + '] ' + _config.fnError);
}
};
exports.default = DEVICE_NETWORK;
//# sourceMappingURL=DEVICE_NETWORK.js.map