Skip to content

Commit 4a1efaa

Browse files
artifacts
1 parent ece94a5 commit 4a1efaa

File tree

12 files changed

+245
-113
lines changed

12 files changed

+245
-113
lines changed

dc.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.js.map

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

dc.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dc.min.js.map

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

web/docs/api-latest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ such as [.svg](#dc.baseMixin+svg) and [.xAxis](#dc.coordinateGridMixin+xAxis),
1111
return values that are themselves chainable d3 objects.
1212

1313
**Kind**: global namespace
14-
**Version**: 2.0.1
14+
**Version**: 2.0.2
1515
**Example**
1616
```js
1717
// Example chaining

web/img/class-hierarchy.svg

Lines changed: 61 additions & 48 deletions
Loading

web/js/dc.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/js/dc.js.map

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

web/js/dc.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/js/dc.min.js.map

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

web/js/queue.js

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
(function (global, factory) {
2+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3+
typeof define === 'function' && define.amd ? define('queue', factory) :
4+
(global.queue = factory());
5+
}(this, function () { 'use strict';
6+
7+
var slice = [].slice;
8+
9+
function noop() {}
10+
11+
var noabort = {};
12+
var success = [null];
13+
function newQueue(concurrency) {
14+
if (!(concurrency >= 1)) throw new Error;
15+
16+
var q,
17+
tasks = [],
18+
results = [],
19+
waiting = 0,
20+
active = 0,
21+
ended = 0,
22+
starting, // inside a synchronous task callback?
23+
error,
24+
callback = noop,
25+
callbackAll = true;
26+
27+
function start() {
28+
if (starting) return; // let the current task complete
29+
while (starting = waiting && active < concurrency) {
30+
var i = ended + active,
31+
t = tasks[i],
32+
j = t.length - 1,
33+
c = t[j];
34+
t[j] = end(i);
35+
--waiting, ++active, tasks[i] = c.apply(null, t) || noabort;
36+
}
37+
}
38+
39+
function end(i) {
40+
return function(e, r) {
41+
if (!tasks[i]) throw new Error; // detect multiple callbacks
42+
--active, ++ended, tasks[i] = null;
43+
if (error != null) return; // only report the first error
44+
if (e != null) {
45+
abort(e);
46+
} else {
47+
results[i] = r;
48+
if (waiting) start();
49+
else if (!active) notify();
50+
}
51+
};
52+
}
53+
54+
function abort(e) {
55+
error = e; // ignore new tasks and squelch active callbacks
56+
waiting = NaN; // stop queued tasks from starting
57+
notify();
58+
}
59+
60+
function notify() {
61+
if (error != null) callback(error);
62+
else if (callbackAll) callback(null, results);
63+
else callback.apply(null, success.concat(results));
64+
}
65+
66+
return q = {
67+
defer: function(f) {
68+
if (callback !== noop) throw new Error;
69+
var t = slice.call(arguments, 1);
70+
t.push(f);
71+
++waiting, tasks.push(t);
72+
start();
73+
return q;
74+
},
75+
abort: function() {
76+
if (error == null) {
77+
var i = ended + active, t;
78+
while (--i >= 0) (t = tasks[i]) && t.abort && t.abort();
79+
abort(new Error("abort"));
80+
}
81+
return q;
82+
},
83+
await: function(f) {
84+
if (callback !== noop) throw new Error;
85+
callback = f, callbackAll = false;
86+
if (!waiting && !active) notify();
87+
return q;
88+
},
89+
awaitAll: function(f) {
90+
if (callback !== noop) throw new Error;
91+
callback = f, callbackAll = true;
92+
if (!waiting && !active) notify();
93+
return q;
94+
}
95+
};
96+
}
97+
98+
function queue(concurrency) {
99+
return newQueue(arguments.length ? +concurrency : Infinity);
100+
}
101+
102+
queue.version = "1.2.1";
103+
104+
return queue;
105+
106+
}));

0 commit comments

Comments
 (0)