sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
HEAD
Rev: 51411 - http://anonsvn.icesoft.org/repo / bridge-support / trunk / src / main / javascript / http.js
Unified Diff View - http.js
/bridge-support/trunk/src/main/javascript/http.js @ revision 51410
/bridge-support/trunk/src/main/javascript/http.js @ revision 51411
@@ -107,6 +107,7 @@     var getAsynchronously = operator();     var postSynchronously = operator();     var postAsynchronously = operator(); +    var deleteAsynchronously = operator();     var Client = exportAs('Client', function(autoclose) {         var newNativeRequest;         if (window.XMLHttpRequest) { @@ -169,7 +170,9 @@                         autoClose(request);                     }                 }; -                nativeRequestResponse.send(asURIEncodedString(withNewQuery(setupQuery))); + +                var requestBody = typeof setupQuery == 'function' ? withNewQuery(setupQuery) : setupQuery; +                nativeRequestResponse.send(requestBody);                 return request;             }); @@ -179,10 +182,27 @@                 var response = ResponseProxy(nativeRequestResponse);                 nativeRequestResponse.open('POST', uri, false);                 setupRequest(request); -                nativeRequestResponse.send(asURIEncodedString(withNewQuery(setupQuery))); +                var requestBody = typeof setupQuery == 'function' ? withNewQuery(setupQuery) : setupQuery; +                nativeRequestResponse.send(requestBody);                 onResponse(response, request);                 autoClose(request);             }); + +            method(deleteAsynchronously, function(self, uri, setupQuery, setupRequest, onResponse) { +                var nativeRequestResponse = newNativeRequest(); +                var request = RequestProxy(nativeRequestResponse); +                var response = ResponseProxy(nativeRequestResponse); +                nativeRequestResponse.open('DELETE', appendToURI(withNewQuery(setupQuery), uri), true); +                setupRequest(request); +                nativeRequestResponse.onreadystatechange = function() { +                    if (nativeRequestResponse.readyState == 4) { +                        onResponse(response, request); +                        autoClose(request); +                    } +                }; +                nativeRequestResponse.send(''); +                return request; +            });         });     }); @@ -319,6 +339,7 @@     exportAs('getAsynchronously', getAsynchronously);     exportAs('postSynchronously', postSynchronously);     exportAs('postAsynchronously', postAsynchronously); +    exportAs('deleteAsynchronously', deleteAsynchronously);     exportAs('close', close);     exportAs('abort', abort);     exportAs('setHeader', setHeader);


feed icon

sventon 2.5.1