Expand all

mw.widgets.MediaResourceQueue

Media resource queue.

Extends

Constructor

new mw.widgets.MediaResourceQueue([config]) #

Create an instance of mw.widgets.MediaResourceQueue.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Description
maxHeight number

The maximum height of the media, used in the search call to the API.

Source:

Methods

addProvider(provider) #

Add a provider to the group.

Parameters:

Name Type Description
provider mw.widgets.APIResultsProvider

A provider object

Inherited from:
Source:
Add a provider to the group.

get([howMany]) → {jQuery.Promise} #

Get items from the queue.

Parameters:

Name Type Attributes Description
howMany number optional

How many items to retrieve. Defaults to the default limit supplied on initialization.

Inherited from:
Source:

Returns:

Promise that resolves into an array of items.

Type
jQuery.Promise
Get items from the queue.

getFileRepos() → {jQuery.Promise} #

Fetch the file repos.

Source:

Returns:

Promise that resolves when the resources are set up

Type
jQuery.Promise
Fetch the file repos.

getLang() → {string|undefined} #

Get language for the query results.

Inherited from:
Source:

Returns:

lang Language

Type
string | undefined
Get language for the query results.

getMaxHeight() → {string} #

Get image maximum height.

Source:

Returns:

Image max height

Type
string
Get image maximum height.

getParams() → {Object} #

Get the data parameters sent to the API.

Inherited from:
Source:

Returns:

params API search parameters

Type
Object
Get the data parameters sent to the API.

getProviders() → {Array.<mw.widgets.APIResultsProvider>} #

Set the providers.

Inherited from:
Source:

Returns:

providers An array of providers

Type
Array.<mw.widgets.APIResultsProvider>
Set the providers.

getQueueSize() → {number} #

Get the queue size.

Inherited from:
Source:

Returns:

Queue size

Type
number
Get the queue size.

getThreshold() → {number} #

Get queue threshold.

Inherited from:
Source:

Returns:

threshold Queue threshold, below which we will request more items

Type
number
Get queue threshold.

queryProviders([howMany]) → {jQuery.Promise} #

Get results from all providers.

Parameters:

Name Type Attributes Description
howMany number optional

How many items to retrieve. Defaults to the default limit supplied on initialization.

Inherited from:
Source:

Returns:

Promise that is resolved into an array of fetched items. Note: The promise must have an .abort() functionality.

Type
jQuery.Promise
Get results from all providers.

reset() #

Reset the queue and all its providers.

Inherited from:
Source:
Reset the queue and all its providers.

setLang(lang) #

Set language for the query results.

Parameters:

Name Type Description
lang string | undefined

Language

Inherited from:
Source:
Set language for the query results.

setParams(params) #

Set the search query for all the providers.

This also makes sure to abort any previous promises.

Parameters:

Name Type Description
params Object

API search parameters

Inherited from:
Source:
Set the search query for all the providers.

setProviders(providers) #

Set the providers.

Parameters:

Name Type Description
providers Array.<mw.widgets.APIResultsProvider>

An array of providers

Inherited from:
Source:
Set the providers.

setThreshold(threshold) #

Set queue threshold.

Parameters:

Name Type Description
threshold number

Queue threshold, below which we will request more items

Inherited from:
Source:
Set queue threshold.

setup() → {jQuery.Promise} #

Set up the queue and its resources. This should be overridden if there are any setup steps to perform.

Inherited from:
Source:

Returns:

Promise that resolves when the resources are set up. Note: The promise must have an .abort() functionality.

Type
jQuery.Promise
Set up the queue and its resources.