async-rails 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/async-rails/version.rb +1 -1
- data/vendor/assets/javascripts/async.js +12 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4dc696b7450ba8f34c9f3066b300a77660644356
|
|
4
|
+
data.tar.gz: 07ece37305768c4e89d0891a0fafa0aad841b67d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f0163a70f13e3bc1c9e70e9c0b599f0755c88e84250e92822fd4f39be66019154a5eb73cbc32a5da82e8e3b37e874f5aea6f2e67c55c9b41a99459e00e8eab1
|
|
7
|
+
data.tar.gz: 011567913c47a220c909da89dfe8595855be4abd721db6dee5129a3e958477a10f03baafe9344e2b26a8537e04e3c401042a7264240281ef56d32848118b0755
|
data/lib/async-rails/version.rb
CHANGED
|
@@ -725,6 +725,7 @@
|
|
|
725
725
|
saturated: null,
|
|
726
726
|
empty: null,
|
|
727
727
|
drain: null,
|
|
728
|
+
paused: false,
|
|
728
729
|
push: function (data, callback) {
|
|
729
730
|
_insert(q, data, false, callback);
|
|
730
731
|
},
|
|
@@ -732,7 +733,7 @@
|
|
|
732
733
|
_insert(q, data, true, callback);
|
|
733
734
|
},
|
|
734
735
|
process: function () {
|
|
735
|
-
if (workers < q.concurrency && q.tasks.length) {
|
|
736
|
+
if (!q.paused && workers < q.concurrency && q.tasks.length) {
|
|
736
737
|
var task = q.tasks.shift();
|
|
737
738
|
if (q.empty && q.tasks.length === 0) {
|
|
738
739
|
q.empty();
|
|
@@ -760,6 +761,16 @@
|
|
|
760
761
|
},
|
|
761
762
|
idle: function() {
|
|
762
763
|
return q.tasks.length + workers === 0;
|
|
764
|
+
},
|
|
765
|
+
pause: function () {
|
|
766
|
+
if (q.paused === true) { return; }
|
|
767
|
+
q.paused = true;
|
|
768
|
+
q.process();
|
|
769
|
+
},
|
|
770
|
+
resume: function () {
|
|
771
|
+
if (q.paused === false) { return; }
|
|
772
|
+
q.paused = false;
|
|
773
|
+
q.process();
|
|
763
774
|
}
|
|
764
775
|
};
|
|
765
776
|
return q;
|