remove old callbacks in Request.JSONP.request_map#1315
remove old callbacks in Request.JSONP.request_map#1315SergioCrisostomo merged 2 commits intomootools:masterfrom
Conversation
|
since that's not official API (the stored responses) BC should be ignored On Tuesday, August 11, 2015, Sergio Crisostomo notifications@github.com
Dimitar Christoff "JavaScript is to JAVA what hamster is to ham" |
|
Agreed with @DimitarChristoff |
|
Nice feedback! will update soonish and ping back. |
61d5759 to
b600ac5
Compare
|
@arian @DimitarChristoff updated |
Source/Request/Request.JSONP.js
Outdated
There was a problem hiding this comment.
Hmmm.
What if the index isn't passed in? If it's required, that's a breaking change.
What if the index passed in isn't the running request?
There was a problem hiding this comment.
it's not breaking because worst case scenario, it will just try to delete an undefined property.
I have a better fix which does not change the API - storing the index within the script tag, then auto deleting
There was a problem hiding this comment.
Good stuff. Might suggest we used data-jsonp-index or something rather than the element attribute, but whatever, it doesn't matter really.
There was a problem hiding this comment.
i considered it but it's so short lived - initially even thought of storage but that meant storage gc when element is removed. i'd agree about data-prop as it ought to be slightly cheaper.
There was a problem hiding this comment.
easier fix still. one liner
Request.JSONP.request_map['request_' + index] = function(){
delete Request.JSONP.request_map['request_' + index];
this.success(arguments, index);
}.bind(this);
so
+ delete Request.JSONP.request_map['request_' + index];
b600ac5 to
37d2406
Compare
|
Updated again. No |
|
@SergioCrisostomo check master...DimitarChristoff:SergioCrisostomo-fix1293 - missed an index and such. |
|
Nice! Yeah, that index was already there from before and is unused. Will cherry pick your work and use it. thanks! Sent from my iPhone
|
remove old callbacks in Request.JSONP.request_map
fixes #1293
Add option to remove old
Request.JSONP.request_mapcallbacks. Defaults tofalseto be BC.