geojs 1.8.4 → 1.8.5
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.
- package/CHANGELOG.md +6 -0
- package/geo.js +29 -14
- package/geo.lean.js +29 -14
- package/geo.lean.min.js +2 -2
- package/geo.min.js +2 -2
- package/package.json +1 -1
- package/src/fetchQueue.js +25 -11
package/package.json
CHANGED
package/src/fetchQueue.js
CHANGED
|
@@ -146,8 +146,8 @@ var fetchQueue = function (options) {
|
|
|
146
146
|
if (defer.__fetchQueue) {
|
|
147
147
|
var pos = $.inArray(defer, m_this._queue);
|
|
148
148
|
if (pos >= 0) {
|
|
149
|
-
m_this._queue.splice(pos, 1);
|
|
150
|
-
m_this._addToQueue(defer, atEnd);
|
|
149
|
+
// m_this._queue.splice(pos, 1);
|
|
150
|
+
m_this._addToQueue(defer, atEnd, pos);
|
|
151
151
|
return defer;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -177,20 +177,34 @@ var fetchQueue = function (options) {
|
|
|
177
177
|
* @param {boolean} atEnd If falsy, add the item to the front of the queue
|
|
178
178
|
* if batching is turned off or at the end of the current batch if it is
|
|
179
179
|
* turned on. If truthy, always add the item to the end of the queue.
|
|
180
|
+
* @param {number} [pos] If specified, the current location in the queue of
|
|
181
|
+
* the object being added. This avoids having to splice, push, or unshift
|
|
182
|
+
* the queue.
|
|
180
183
|
*/
|
|
181
|
-
this._addToQueue = function (defer, atEnd) {
|
|
184
|
+
this._addToQueue = function (defer, atEnd, pos) {
|
|
185
|
+
let move = atEnd ? m_this._queue.length - 1 : 0;
|
|
182
186
|
defer.__fetchQueue._batch = m_this._batch;
|
|
183
|
-
if (atEnd) {
|
|
184
|
-
m_this._queue.
|
|
185
|
-
|
|
186
|
-
m_this._queue.unshift(defer);
|
|
187
|
-
} else {
|
|
188
|
-
for (var i = 0; i < m_this._queue.length; i += 1) {
|
|
189
|
-
if (m_this._queue[i].__fetchQueue._batch !== m_this._batch) {
|
|
187
|
+
if (!atEnd && m_this._batch) {
|
|
188
|
+
for (move = 0; move < m_this._queue.length - (pos === undefined ? 0 : 1); move += 1) {
|
|
189
|
+
if (m_this._queue[move].__fetchQueue._batch !== m_this._batch) {
|
|
190
190
|
break;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
}
|
|
194
|
+
if (pos === undefined) {
|
|
195
|
+
if (atEnd) {
|
|
196
|
+
m_this._queue.push(defer);
|
|
197
|
+
} else if (!move) {
|
|
198
|
+
m_this._queue.unshift(defer);
|
|
199
|
+
} else {
|
|
200
|
+
m_this._queue.splice(move, 0, defer);
|
|
201
|
+
}
|
|
202
|
+
} else if (pos !== move) {
|
|
203
|
+
const dir = pos < move ? 1 : -1;
|
|
204
|
+
for (let i = pos; i !== move; i += dir) {
|
|
205
|
+
m_this._queue[i] = m_this._queue[i + dir];
|
|
206
|
+
}
|
|
207
|
+
m_this._queue[move] = defer;
|
|
194
208
|
}
|
|
195
209
|
};
|
|
196
210
|
|