Skip to content

Commit 759ef5b

Browse files
committed
chore: adjust comments
1 parent 56c3d2b commit 759ef5b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ import jsonp from 'better-jsonp'
6161
```js
6262
jsonp({
6363
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
6666
timeout: 5000,
6767
// eg. ?customCallbackParams=...
6868
callbackParams: 'customCallbackParams',
@@ -94,7 +94,7 @@ jsonp({
9494
| options parameter | type | required | description |
9595
| ----------------- | ---- | -------- | ----------- |
9696
| `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 |
9898
| `jsonpCallback` | `String` | false, default : `'callback'+Date.now()` | global callback function name which is used to handle JSONP response. |
9999
| `callbackParams` | `String` | false, default: `jsonpCallback` | name of query parameter to specify the callback name |
100100
| `urlParams` | `Object` | false, default: `{}` | other parameters in query string parameters |

lib/core/Jsonp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export default class Jsonp {
9494

9595
// create a request timer for limiting request period
9696
createTimer (timeout: options['timeout']) {
97+
// It can be disable when param timeout equal falsy value (0, null etc.)
9798
if (timeout) {
9899
this._timer = window.setTimeout(() => {
99100
(<any>window)[this._jsonpCallback] = noop

0 commit comments

Comments
 (0)