Skip to content

Commit 3ab48ce

Browse files
author
Gaëtan Renaudeau
committed
Improve README, set to v0.1.6
1 parent e3b3b83 commit 3ab48ce

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ var lastYearYoungPeople =
123123
More 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

139149
Here is a typical use case:
140150

141151
```javascript
142-
var xhr = null;
152+
var cancellationD = null;
143153
function 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```.
184194
Release 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+
187203
0.1.5
188204

189205
* Put global configuration variables in a `Qajax.defaults` Object.

build/qajax.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "qajax",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "Simple Promise ajax library based on Q",
55
"keywords": [
66
"q",

0 commit comments

Comments
 (0)