fluxible-plugin-fetchr
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -73,8 +73,9 @@ /** | ||
context: xhrContext, | ||
contextPicker: options.contextPicker | ||
contextPicker: options.contextPicker, | ||
}; | ||
if (typeof options.statsCollector === 'function') { | ||
fetchrOptions.statsCollector = function collectFetcherStats(stats) { | ||
options.statsCollector(actionContext, stats); | ||
}; | ||
fetchrOptions.statsCollector = | ||
function collectFetcherStats(stats) { | ||
options.statsCollector(actionContext, stats); | ||
}; | ||
} | ||
@@ -86,17 +87,38 @@ var service = new Fetchr(fetchrOptions); | ||
update: service.update.bind(service), | ||
'delete': service['delete'].bind(service), | ||
constructGetXhrUri: function constructGetXhrUri(resource, params, config) { | ||
delete: service.delete.bind(service), | ||
constructGetXhrUri: function constructGetXhrUri( | ||
resource, | ||
params, | ||
config | ||
) { | ||
config = config || {}; | ||
uri = config.cors ? corsPath : currentXhrPath; | ||
var getUriFn = config.constructGetUri || defaultConstructGetUri; | ||
return getUriFn.call(service, uri, resource, params, config, xhrContext); | ||
var getUriFn = | ||
config.constructGetUri || | ||
defaultConstructGetUri; | ||
return getUriFn.call( | ||
service, | ||
uri, | ||
resource, | ||
params, | ||
config, | ||
xhrContext | ||
); | ||
}, | ||
updateOptions: function (options) { | ||
currentXhrPath = options.xhrPath ? options.xhrPath : currentXhrPath; | ||
xhrTimeout = options.xhrTimeout ? options.xhrTimeout : xhrTimeout; | ||
corsPath = options.corsPath ? options.corsPath : corsPath; | ||
service.updateOptions && service.updateOptions(options); | ||
} | ||
currentXhrPath = options.xhrPath | ||
? options.xhrPath | ||
: currentXhrPath; | ||
xhrTimeout = options.xhrTimeout | ||
? options.xhrTimeout | ||
: xhrTimeout; | ||
corsPath = options.corsPath | ||
? options.corsPath | ||
: corsPath; | ||
service.updateOptions && | ||
service.updateOptions(options); | ||
}, | ||
}; | ||
actionContext.getServiceMeta = service.getServiceMeta.bind(service); | ||
actionContext.getServiceMeta = | ||
service.getServiceMeta.bind(service); | ||
}, | ||
@@ -113,3 +135,3 @@ /** | ||
xhrTimeout: xhrTimeout, | ||
corsPath: corsPath | ||
corsPath: corsPath, | ||
}; | ||
@@ -127,3 +149,3 @@ }, | ||
corsPath = state.corsPath; | ||
} | ||
}, | ||
}; | ||
@@ -136,3 +158,3 @@ }, | ||
registerService: function registerService(service) { | ||
Fetchr.registerFetcher(service); | ||
Fetchr.registerService(service); | ||
}, | ||
@@ -156,4 +178,4 @@ /** | ||
return xhrPath; | ||
} | ||
}, | ||
}; | ||
}; |
{ | ||
"name": "fluxible-plugin-fetchr", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A plugin for Fluxible applications to provide an isomorphic interface for RESTful services", | ||
@@ -11,4 +11,4 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "../../node_modules/.bin/mocha tests/unit/", | ||
"cover": "BABEL_ENV=test ../../node_modules/.bin/nyc ../../node_modules/.bin/_mocha tests/unit/", | ||
"test": "../../node_modules/.bin/jest", | ||
"cover": "../../node_modules/.bin/jest --coverage", | ||
"lint": "../../node_modules/.bin/eslint lib/ tests/ utils/ index.js" | ||
@@ -15,0 +15,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
function MockServiceManager () { | ||
function MockServiceManager() { | ||
this.services = {}; | ||
@@ -16,3 +16,5 @@ this.serviceCalls = []; | ||
if (!this.services[name]) { | ||
throw new Error('Fetcher ' + name + ' has not been registered to mock fetcher'); | ||
throw new Error( | ||
'Fetcher ' + name + ' has not been registered to mock fetcher' | ||
); | ||
} | ||
@@ -38,3 +40,3 @@ this.services[name].apply(null, args); | ||
MockServiceManager.prototype['delete'] = function (name) { | ||
MockServiceManager.prototype.delete = function (name) { | ||
var args = Array.prototype.slice.call(arguments); | ||
@@ -41,0 +43,0 @@ args.shift(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17414
218