File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,8 @@ import jsonp from 'better-jsonp'
61
61
``` js
62
62
jsonp ({
63
63
url: ' http://localhost' ,
64
- // global function named `${jsonpCallback} ` will be invoked when JSONP response
65
- jsonpCallback: ' jsonpCallback ' , // any different name from request module
64
+ // global function named `callback ` will be invoked when JSONP response
65
+ jsonpCallback: ' callback ' , // any different name from request module
66
66
timeout: 5000 ,
67
67
// eg. ?customCallbackParams=...
68
68
callbackParams: ' customCallbackParams' ,
@@ -94,7 +94,7 @@ jsonp({
94
94
| options parameter | type | required | description |
95
95
| ----------------- | ---- | -------- | ----------- |
96
96
| ` url ` | ` String ` | true | JSONP request address |
97
- | ` timeout ` | ` Number ` | false, default : ` 6000 ` | how long after timeout error is emitted. ` 0 ` to disable |
97
+ | ` timeout ` | ` Number ` | false, default : ` 6000 ` milliseconds | how long after timeout error is emitted. ` 0 ` to disable |
98
98
| ` jsonpCallback ` | ` String ` | false, default : ` 'callback'+Date.now() ` | global callback function name which is used to handle JSONP response. |
99
99
| ` callbackParams ` | ` String ` | false, default: ` jsonpCallback ` | name of query parameter to specify the callback name |
100
100
| ` urlParams ` | ` Object ` | false, default: ` {} ` | other parameters in query string parameters |
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ export default class Jsonp {
94
94
95
95
// create a request timer for limiting request period
96
96
createTimer ( timeout : options [ 'timeout' ] ) {
97
+ // It can be disable when param timeout equal falsy value (0, null etc.)
97
98
if ( timeout ) {
98
99
this . _timer = window . setTimeout ( ( ) => {
99
100
( < any > window ) [ this . _jsonpCallback ] = noop
You can’t perform that action at this time.
0 commit comments