Commit d641901
feat($resource): add support for timeout in cancellable actions
Old behavior: actions can be either cancellable or have a numeric timeout.
When having both defined, cancellable was ignored.
With this commit: it's possible for actions to have both cancellable:true
and numeric timeout defined.
Example usage:
```js
var Post = $resource('/posts/:id', {id: '@id'}, {
get: {
method: 'GET',
cancellable: true,
timeout: 10000
}
});
var currentPost = Post.get({id: 1});
...
// the next request can cancel the previous one
currentPost.$cancelRequest();
currentPost = Post.get({id: 2});
// any of those requests will also timeout, if the response
// doesn't come within 10 seconds
```
Closes angular#138241 parent eae0a11 commit d641901
2 files changed
+52
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
163 | | - | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
| 419 | + | |
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
592 | 591 | | |
593 | 592 | | |
594 | 593 | | |
| |||
639 | 638 | | |
640 | 639 | | |
641 | 640 | | |
| 641 | + | |
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
659 | 663 | | |
660 | 664 | | |
661 | 665 | | |
| |||
706 | 710 | | |
707 | 711 | | |
708 | 712 | | |
709 | | - | |
| 713 | + | |
| 714 | + | |
710 | 715 | | |
711 | 716 | | |
712 | 717 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1372 | 1372 | | |
1373 | 1373 | | |
1374 | 1374 | | |
| 1375 | + | |
1375 | 1376 | | |
1376 | 1377 | | |
1377 | 1378 | | |
| |||
1380 | 1381 | | |
1381 | 1382 | | |
1382 | 1383 | | |
1383 | | - | |
| 1384 | + | |
1384 | 1385 | | |
1385 | 1386 | | |
| 1387 | + | |
1386 | 1388 | | |
1387 | 1389 | | |
1388 | 1390 | | |
| |||
1531 | 1533 | | |
1532 | 1534 | | |
1533 | 1535 | | |
1534 | | - | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
1535 | 1539 | | |
1536 | 1540 | | |
1537 | 1541 | | |
| |||
1540 | 1544 | | |
1541 | 1545 | | |
1542 | 1546 | | |
1543 | | - | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
1544 | 1553 | | |
1545 | | - | |
1546 | 1554 | | |
1547 | 1555 | | |
1548 | 1556 | | |
| |||
1562 | 1570 | | |
1563 | 1571 | | |
1564 | 1572 | | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
1565 | 1591 | | |
1566 | 1592 | | |
1567 | 1593 | | |
| |||
0 commit comments