new fetchQueue(optionsopt) → {geo.fetchQueue}
- Description:
This class implements a queue for Deferred objects. Whenever one of the objects in the queue completes (resolved or rejected), another item in the queue is processed. The number of concurrently processing items can be adjusted.
At this time (2018-11-02) most major browsers support 6 concurrent requests from any given server, so, when using the queue for tile images, the number of concurrent requests should be 6 * (number of subdomains serving tiles).
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
geo.fetchQueue.spec |
<optional> |
A configuration object for the queue. |
Returns:
- Type
- geo.fetchQueue
Members
initialSize
- Description:
Get/set the initial maximum concurrent deferred object size.
- Source:
Properties:
Name | Type | Description |
---|---|---|
initialSize |
number | The initial maximum number of deferred
objects. |
Get/set the initial maximum concurrent deferred object size.
intitialTrack
- Description:
Get/set the initial track size. Unless changed, this is the value used for track on class initialization.
- Source:
Properties:
Name | Type | Description |
---|---|---|
initialTrack |
number | The number of entries to track without checking for discards. |
Get/set the initial track size. Unless changed, this is the value used for track on class initialization.
length
- Description:
Get the current queue size. Read only.
- Source:
Properties:
Name | Type | Description |
---|---|---|
length |
number | The current queue size. |
Get the current queue size. Read only.
processing
- Description:
Get the current number of processing items. Read only.
- Source:
Properties:
Name | Type | Description |
---|---|---|
processing |
number | The current number of processing items. |
Get the current number of processing items. Read only.
size
- Description:
Get/set the maximum concurrent deferred object size.
- Source:
Properties:
Name | Type | Description |
---|---|---|
size |
number | The maximum number of deferred objects. |
Get/set the maximum concurrent deferred object size.
track
- Description:
Get/set the track size. This is used to determine when to check if entries can be discarded.
- Source:
Properties:
Name | Type | Description |
---|---|---|
track |
number | The number of entries to track without checking for discards. |
Get/set the track size. This is used to determine when to check if entries can be discarded.
Methods
add(defer, callback, atEnd) → {jQuery.Deferred}
- Description:
Add a Deferred object to the queue.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
defer |
jQuery.Deferred | Deferred object to add to the queue. |
callback |
function | A function to call when the item's turn is granted. |
atEnd |
boolean | If falsy, add the item to the front of the queue if batching is turned off or at the end of the current batch if it is turned on. If truthy, always add the item to the end of the queue. |
Returns:
The deferred object that was passed to the function.
- Type
- jQuery.Deferred
batch(start) → {number|boolean|this}
- Description:
Start a new batch or clear using batches.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
start |
boolean | Truthy to start a new batch, falsy to turn off
using batches. |
Returns:
false
if batches are turned off, the
batch number if turned on, or this
if setting the batch.
- Type
- number | boolean | this
clear() → {this}
- Description:
Remove all items from the queue.
- Source:
Returns:
- Type
- this
get(defer) → {number}
- Description:
Get the position of a deferred object in the queue.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
defer |
jQuery.Deferred | Deferred object to get the position of. |
Returns:
-1 if not in the queue, or the position in the queue.
- Type
- number
next_item()
- Description:
Check if any items are queued and if the processing allotment is not full. If so, process more items.
- Source:
remove(defer) → {boolean}
- Description:
Remove a Deferred object from the queue.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
defer |
jQuery.Deferred | Deferred object to add to the queue. |
Returns:
true
if the object was removed.
- Type
- boolean
Type Definitions
spec
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
size |
number |
<optional> |
6
|
The maximum number of concurrent deferred objects. |
track |
number |
<optional> |
600
|
The number of objects that are tracked that
trigger checking if any of them have been abandoned. The fetch queue can
grow to the greater of this size and the number of items that are still
needed. Setting this to a low number will increase processing time, to a
high number can increase memory. Ideally, it should reflect the number of
items that are kept in memory elsewhere. If |
needed |
function |
<optional> |
null
|
If set, this function is passed a Deferred object and must return a truthy value if the object is still needed. |
Type:
- object