Skip to content

Latest commit

 

History

History
104 lines (74 loc) · 3.81 KB

File metadata and controls

104 lines (74 loc) · 3.81 KB

FetchQueue

The FetchQueue class is a utility class that allows for managing and controlling concurrent fetch requests. It ensures that the number of active requests does not exceed a specified limit, and queues any additional requests until a slot becomes available.

Kind: global class

new FetchQueue(options)

Initializes a new instance of the FetchQueue class with an optional FetchQueueConfig object. If no options are provided, the default concurrent value is set to 3.

Param Type Description
options FetchQueueConfig

The FetchQueueConfig object containing the concurrent value.

fetchQueue.getFetchMethod() ⇒

Returns the custom fetch function used by the FetchQueue class to handle queuing of fetch requests.

Kind: instance method of FetchQueue
Returns:

The custom fetch function.


fetchQueue.getConcurrent() ⇒

Kind: instance method of FetchQueue
Returns:

value of concurrent property


fetchQueue.setConcurrent(concurrent)

set value of concurrent property

Kind: instance method of FetchQueue

Param Type
concurrent number

fetchQueue.getDebug() ⇒

Kind: instance method of FetchQueue
Returns:

value of debug property


fetchQueue.setDebug(debug)

set value of debug property

Kind: instance method of FetchQueue

Param Type
debug boolean

fetchQueue.emptyQueue(urlPattern)

Empties the queue of fetch requests.

Kind: instance method of FetchQueue

Param Description
urlPattern

Optional regular expression to match against the URLs in the queue. If provided, only the requests with URLs that match the pattern will be aborted. If not provided, all requests in the queue will be aborted.

fetchQueue.pauseQueue() ⇒ void

Disables the queuing of fetch requests in the FetchQueue.

Kind: instance method of FetchQueue

fetchQueue.startQueue() ⇒ void

Enables the queuing of fetch requests in the FetchQueue.

Kind: instance method of FetchQueue

fetchQueue.getQueueLength() ⇒

Kind: instance method of FetchQueue
Returns:

Length of queue


fetchQueue.getActiveRequests() ⇒

Kind: instance method of FetchQueue
Returns:

Number of active requests