fetch-default
Advanced tools
+6
-2
@@ -28,4 +28,8 @@ 'use strict'; | ||
| return response; | ||
| }, fail.bind(initFetchPromise)); | ||
| if (dataFilter) oldFetchPromise = oldFetchPromise.then(dataFilter.bind(initFetchPromise)); | ||
| }, function (reject) { | ||
| return fail.call(oldFetchPromise, reject); | ||
| }); | ||
| if (dataFilter) oldFetchPromise = oldFetchPromise.then(function (response) { | ||
| return dataFilter.call(oldFetchPromise, response); | ||
| }); | ||
@@ -32,0 +36,0 @@ return oldFetchPromise; |
+2
-3
@@ -6,3 +6,2 @@ (function(win) { | ||
| win.fetch = (uri, ...rest) => { | ||
| //整合所有opts | ||
@@ -22,4 +21,4 @@ let allOpts = Object.assign({}, opt, ...rest, { | ||
| if (fail) oldFetchPromise = oldFetchPromise.then((response) => response, fail.bind(initFetchPromise)); | ||
| if (dataFilter) oldFetchPromise = oldFetchPromise.then(dataFilter.bind(initFetchPromise)); | ||
| if (fail) oldFetchPromise = oldFetchPromise.then((response) => response,(reject) => fail.call(oldFetchPromise,reject)); | ||
| if (dataFilter) oldFetchPromise = oldFetchPromise.then((response) => dataFilter.call(oldFetchPromise,response)); | ||
@@ -26,0 +25,0 @@ return oldFetchPromise; |
+1
-1
| { | ||
| "name": "fetch-default", | ||
| "version": "1.0.14", | ||
| "version": "1.0.15", | ||
| "description": "Add global default properties for the web fetch", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
7724
2.06%92
4.55%