Allow overriding config options in EvaporateJs 2.0#29
Conversation
In EvaporateJs 2.0, the Evaporate.add() function now takes a second argument, overrideConfig. This allows for overriding the global config settings for each request. This patch allows for specifying a property on AngularEvaporateUpload called overrideConfig. If specified, this will be passed in to Evaporate.add() as a second argument. I know Angular Evaporate doesn't officially support EvaporateJs 2.0 yet, but I think this patch is a useful workaround until proper support can be added.
uqee
left a comment
There was a problem hiding this comment.
Thanks for the effort to improve the lib, but I'm pretty positive it would be much better to make a complete support instead of local patches, which will confuse people.
If it helps you somehow, you can still link your own branch in a package.json file until someone (or me) pushes an upgrade. Sooner, rather than later, I hope.
| AngularEvaporate.prototype.$start = function (upload) { | ||
|
|
||
| var args = Array.prototype.slice.call(arguments); | ||
| args[1] = upload.overrideConfig; |
There was a problem hiding this comment.
And args being the shallow copy of arguments is not going to be used later, what's the point? Does this work for you?
There was a problem hiding this comment.
My bad, I must've screwed up my commit somehow. args is meant to be passed in to this.add, instead of arguments. Ideally I'd like to just set arguments[1] instead of doing a shallow copy, but because arguments is a special type and not actually an array it seems that this doesn't work.
I forgot a change in my last commit
|
I understand, I rather expected that to be the response but I thought I'd try anyway. I thought this patch might be okay because it's completely backwards compatible, but I totally get what you're saying. The main reason I tried to do a pull request is that I need this functionality in my own app and I didn't want to have to maintain a fork. |
In EvaporateJs 2.0, the Evaporate.add() function now takes a second argument, overrideConfig. This allows for overriding the global config settings for each request.
This patch allows for specifying a property on AngularEvaporateUpload called overrideConfig. If specified, this will be passed in to Evaporate.add() as a second argument.
I know Angular Evaporate doesn't officially support EvaporateJs 2.0 yet, but I think this patch is a useful workaround until proper support can be added.