+1
-1
@@ -5,3 +5,3 @@ { | ||
| "description": "A sane JSONP implementation.", | ||
| "version": "0.0.4", | ||
| "version": "0.1.0", | ||
| "dependencies": { | ||
@@ -8,0 +8,0 @@ "visionmedia/debug": "*" |
+7
-0
| 0.1.0 / 2014-12-30 | ||
| ================== | ||
| * Make sure `script.parentNode` exists before removing the script element (#12, @azer) | ||
| * Return function to cancel in-progress jsonp request (#11, @feross) | ||
| * add documentation for `prefix` option (#10, @feross) | ||
| 0.0.4 / 2014-03-11 | ||
@@ -3,0 +10,0 @@ ================== |
+10
-2
@@ -63,9 +63,15 @@ /** | ||
| function cleanup(){ | ||
| script.parentNode.removeChild(script); | ||
| if (script.parentNode) script.parentNode.removeChild(script); | ||
| window[id] = noop; | ||
| if (timer) clearTimeout(timer); | ||
| } | ||
| function cancel(){ | ||
| if (window[id]) { | ||
| cleanup(); | ||
| } | ||
| } | ||
| window[id] = function(data){ | ||
| debug('jsonp got', data); | ||
| if (timer) clearTimeout(timer); | ||
| cleanup(); | ||
@@ -85,2 +91,4 @@ if (fn) fn(null, data); | ||
| target.parentNode.insertBefore(script, target); | ||
| return cancel; | ||
| } |
+1
-1
| { | ||
| "name": "jsonp", | ||
| "description": "A sane JSONP implementation.", | ||
| "version": "0.0.4", | ||
| "version": "0.1.0", | ||
| "dependencies": { | ||
@@ -6,0 +6,0 @@ "debug": "*" |
+6
-1
@@ -30,5 +30,7 @@ | ||
| disable (defaults to `60000`) | ||
| - `prefix` (`String`) prefix for the global callback functions that | ||
| handle jsonp responses (defaults to `__jp`) | ||
| - `fn` callback | ||
| The callback is called with `err, data` parameters. | ||
| The callback is called with `err, data` parameters. | ||
@@ -38,4 +40,7 @@ If it times out, the `err` will be an `Error` object whose `message` is | ||
| Returns a function that, when called, will cancel the in-progress jsonp request | ||
| (`fn` won't be called). | ||
| ## License | ||
| MIT |
4023
17.22%86
7.5%45
12.5%