active-resource.js
active-resource.js copied to clipboard
Allow custom definition of request adapter
Stories
- As a developer, I may use (or be required to use) a promise library other than the heavy-duty
jQuery.ajax
, so I want to be able to customize myactive-resource
resourceLibrary
my promise library for processing async requests
Work
- [ ] Add optional argument
requestAdapter
of typefunction
when definingresourceLibrary
var resourceLibrary = ActiveResource.createResourceLibrary(
'https://api.example.com/v1',
{
requestAdapter: function(method, url, data, headers) {
return promiseLibrary([do something with these 4 args]);
};
}
);
- [ ] Enable base adapter to use provided
requestAdapter
, or use default - [ ] Add a default request adapter that works with both browser and Node environments #8