1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var whenx = (function () {
|
7 | 'use strict';
|
8 |
|
9 | var version = "1.1.5";
|
10 |
|
11 | var thenx= (name, opts= {})=>{
|
12 | return new Promise((resolve, reject)=>{
|
13 | var method= wx[name]( Object.assign(opts, {
|
14 | success: res=> resolve(res)
|
15 | ,fail: err=> reject(err)
|
16 | ,complete: opts.complete
|
17 | }) );
|
18 | if(opts.progress){
|
19 | if(typeof opts.progress== "function"){
|
20 | var task= method;
|
21 | Function.call(opts.progress, task);
|
22 | }
|
23 | else console.warn(`[whenx]progress must be a function to call with task but not: ${typeof(opts.progress)}`);
|
24 | }
|
25 | })
|
26 | };
|
27 |
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | var thenx_1= thenx;
|
36 |
|
37 | var thenx$1 = ({
|
38 | default: thenx_1,
|
39 | __moduleExports: thenx_1
|
40 | });
|
41 |
|
42 | var whenx= function(_wx= {}){
|
43 | for(let k in wx){
|
44 | if(typeof(wx[k]) === 'function'){
|
45 |
|
46 | _wx[k]= (v)=> thenx_1.call(this, k, v);
|
47 | }
|
48 | else{
|
49 |
|
50 | _wx[k]= wx[k];
|
51 | }
|
52 | }
|
53 | return _wx
|
54 | }();
|
55 |
|
56 | |
57 |
|
58 |
|
59 |
|
60 |
|
61 | var whenx_1= whenx;
|
62 |
|
63 | var whenx$1 = ({
|
64 | default: whenx_1,
|
65 | __moduleExports: whenx_1
|
66 | });
|
67 |
|
68 | var main$1= whenx$1;
|
69 |
|
70 | main$1.whenx= whenx$1;
|
71 | main$1.thenx= thenx$1;
|
72 | main$1._version_= version;
|
73 |
|
74 | return main$1;
|
75 |
|
76 | }());
|