Skip to content

Commit 4ff9db4

Browse files
committed
update
1 parent 0f23631 commit 4ff9db4

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

.DS_Store

0 Bytes
Binary file not shown.

jQuery-free/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
<script src="./server.js"></script>
1414
<script>
1515
var data = {
16-
// url: encodeURIComponent(window.location.href)
17-
a: 1,
18-
b: 2,
19-
c: 3
16+
url: encodeURIComponent(window.location.href)
17+
// a: 1,
18+
// b: 2,
19+
// c: 3
2020
};
2121
ajax({
2222
data: data,
2323
url: 'https://h5.kankanapp.com.cn/wechatapi/',
24-
// dataType: 'jsonp',
25-
type: 'post',
24+
dataType: 'jsonp',
25+
type: 'get',
2626
done: function(json) {
2727
console.log(JSON.stringify(json));
2828
}

jQuery-free/server.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,21 @@ function ajax(opts) {
7474
window[callbackName] = function(json) {
7575
oHead.removeChild(oScript);
7676
window[callbackName] = null;
77+
window.clearTimeout(oScript.timer);
7778
opts.success && opts.success(json);
7879
opts.done && opts.done(json);
7980
};
8081

8182
//发起请求
8283
oScript.src = opts.url + '?' + params;
84+
85+
if (opts.time) {
86+
oScript.timer = window.setTimeout(function() {
87+
oHead.removeChild(oScript);
88+
window[callbackName] = null;
89+
opts.fail && opts.fail({message: 'timeout'});
90+
opts.done && opts.fail({message: 'timeout'});
91+
}, opts.time);
92+
}
8393
}
8494
}

waterFall/.DS_Store

0 Bytes
Binary file not shown.

waterFall/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
### Usage
2+
3+
```
4+
init:
5+
var wtf = new WaterFull('.content', {
6+
type: listType,
7+
urlField: 'picUrl'
8+
});
9+
10+
create:
11+
wtf.create(dataArr);
12+
```

0 commit comments

Comments
 (0)