-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathALERT.js
More file actions
55 lines (49 loc) · 1.37 KB
/
ALERT.js
File metadata and controls
55 lines (49 loc) · 1.37 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
/**
* @api ALERT(title,message,buttons,fn) ALERT
* @apiGroup APP
* @apiVersion 1.0.0
* @apiParam {string} title 标题
* @apiParam {string} message 内容
* @apiParam {array} buttons 按钮
* @apiParam {function} function 点击按钮回调
* @apiDescription app alert 事件
* @apiUse APPNpm
* @apiUse APPJs
* @apiParamExample {string} 例子
* ALERT('提示','这里是提示详情文案',['确定','取消'],({buttonIndex})=>{
* console.log(buttonIndex)
* })
* @apiParamExample {string} 返回值
* {
* buttonIndex: 0 //点了哪个按钮 buttons数组下标
* }
**/
/**
* todo TOOLS
*/
Object.defineProperty(exports, "__esModule", {
value: true
});
var _config = require('./APP/config');
var name = 'ALERT';
var ALERT = function ALERT(obj) {
var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (_) {};
if (typeof fn === 'function') {
(0, _config.WinJSDec)(function (_) {
window.WinJSBridge.call('tools', 'alert', obj, 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 = ALERT;
//# sourceMappingURL=ALERT.js.map