BufferQueue

This is the main object of the BufferQueue library.

Emitted events:

  • 'added': when a new element to download is added to the queue
  • 'removed': when an element is removed (and will not be downloaded)
  • 'reseted': when the whole queue is reseted
  • 'downloading': when a file is starting to be downloading (after being popped from the queue)
  • 'failed': when a file could not be downloaded properly (status above 2xx)
  • 'aborted': when a file download is aborted by an explicit abort() call
  • 'success': when a file has been successfully downloaded and converted into an ArrayBuffer. Callback arguments are URL, ArrayBuffer, downloadTimeMs
new BufferQueue(options: Object)

Extends EventManager

Parameters
options (Object) the option object
Instance Members
getPriority(str)
has(str, priority)
isDownloadInProcess(str)
add(str, priority, priorityScore, true)
isEmpty()
size(priority, number)
sizePerPriority()
remove(str, null-null)
reset()
abort(str)
abortAll()
getStatus()
sortWithinLevel()

PriorityQueue

This priority queue works with levels of priority, 0 beeing the highest priority and following level will be of decreasing priority. In term of implementation, PriorityQueue instanciates N Queues, where N is the number of priority levels. The number of priority levels has to be given at the creation of a PriorityQueue instance.

new PriorityQueue(levels: any)
Parameters
levels (any = 3)
Instance Members
getPriority(str)
has(str, priority)
add(str, priority, priorityScore, true)
pop_ORIG()
pop()
isEmpty()
size(priority, number)
sizePerPriority()
remove(str, null-null)
reset()
getStatus()
sortWithinLevel()

Queue

A queue to add and pop string. It also provides an arbitrary remove function. A queue is first-in-first-out. Elements in this queue must be strings

new Queue()
Instance Members
add(str, priorityScore)
has(str)
pop()
isEmpty()
size(number)
first()
last()
remove(str)
reset()
sortByPriorityScore()

EventManager

The EventManager deals with events, create them, call them. This class is mostly for being inherited from.

new EventManager()
Instance Members
on(eventName, callback)
emit(eventName, args)