#1774 Ability to cancel a Protocol request, r=fredj (closes #1774)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@8420 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2008-11-28 16:09:40 +00:00
parent 274afe0a5f
commit 8c06729f6b
4 changed files with 42 additions and 27 deletions
+10
View File
@@ -139,6 +139,16 @@ OpenLayers.Protocol = OpenLayers.Class({
*/
commit: function() {
},
/**
* Method: abort
* Abort an ongoing request.
*
* Parameters:
* response - {<OpenLayers.Protocol.Response>}
*/
abort: function(response) {
},
CLASS_NAME: "OpenLayers.Protocol"
});
+15
View File
@@ -441,6 +441,21 @@ OpenLayers.Protocol.HTTP = OpenLayers.Class(OpenLayers.Protocol, {
return resp;
},
/**
* Method: abort
* Abort an ongoing request, the response object passed to
* this method must come from this HTTP protocol (as a result
* of a create, read, update, delete or commit operation).
*
* Parameters:
* response - {<OpenLayers.Protocol.Response>}
*/
abort: function(response) {
if (response) {
response.priv.abort();
}
},
/**
* Method: callUserCallback
* This method is used from within the commit method each time an
+2 -6
View File
@@ -157,13 +157,9 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
* returned by the layer protocol.
*/
triggerRead: function() {
var filter = this.createFilter();
if (this.response && this.response.priv &&
typeof this.response.priv.abort == "function") {
this.response.priv.abort();
}
this.layer.protocol.abort(this.response);
this.response = this.layer.protocol.read({
filter: filter,
filter: this.createFilter(),
callback: this.merge,
scope: this
});