@@ -123,6 +123,16 @@ var lastYearYoungPeople =
123123More advanced features
124124---
125125
126+ * You can get ** progress** event of the Ajax download. Exemple:
127+
128+ ``` javascript
129+ Qajax (" /download" ).progress (function (xhrProgressEvent ) {
130+ console .log (xhrProgressEvent);
131+ });
132+ ```
133+
134+ See also: https://dvcs.w3.org/hg/progress/raw-file/tip/Overview.html#progressevent
135+
126136* Qajax has a ** timeout** :
127137
128138``` javascript
@@ -134,20 +144,20 @@ The default timeout is `Qajax.defaults.timeout` and can be overriden.
134144
135145* You can set XHR headers by giving the ` header ` options.
136146
137- * You can give your own ` XMLHttpRequest ` object to use!
147+ * You can give a ` cancellation ` Promise to abort an ajax request.
138148
139149Here is a typical use case:
140150
141151``` javascript
142- var xhr = null ;
152+ var cancellationD = null ;
143153function getResults (query ) {
144- if (xhr ) {
145- xhr . abort ();
154+ if (cancellationD ) {
155+ cancellationD . resolve ();
146156 }
147- xhr = new XMLHttpRequest ();
157+ cancellationD = Q . defer ();
148158 return Qajax ({
149159 url: " /search?" + Qajax .serialize ({ q: query }),
150- xhr : xhr
160+ cancellation : cancellationD . promise
151161 })
152162 .then (Qajax .filterSuccess )
153163 .then (Qajax .toJSON );
@@ -184,6 +194,12 @@ Then run ```grunt```.
184194Release Note
185195---
186196
197+ 0.1.6
198+
199+ * Implement the ` onprogress ` XHR event support using the ** progress** event of the returned Promise.
200+ * Introduce ` cancellation ` parameter. It allows to provide a "cancellation" promise which if fulfilled will cancel the current XHR.
201+ * Deprecate the ` xhr ` parameter: use ` cancellation ` instead.
202+
1872030.1.5
188204
189205* Put global configuration variables in a ` Qajax.defaults ` Object.
0 commit comments