Extends
Constructor
new mw.widgets.MediaResourceQueue([config])
#
Methods
addProvider(provider)
#
Add a provider to the group.
Parameters:
Name | Type | Description |
---|---|---|
provider |
mw.widgets.APIResultsProvider | A provider object |
- Inherited from:
- Source:
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
getFileRepos() → {jQuery.Promise}
#
Fetch the file repos.
Returns:
Promise that resolves when the resources are set up
- Type
- jQuery.Promise
getLang() → {string|undefined
}
#
undefined
}
#
Get language for the query results.
- Inherited from:
- Source:
Returns:
lang Language
- Type
-
string
|
undefined
getParams() → {Object}
#
Get the data parameters sent to the API.
- Inherited from:
- Source:
Returns:
params API search parameters
- Type
- Object
getProviders() → {Array.<mw.widgets.APIResultsProvider>}
#
Set the providers.
- Inherited from:
- Source:
Returns:
providers An array of providers
getQueueSize() → {number}
#
getThreshold() → {number}
#
Get queue threshold.
- Inherited from:
- Source:
Returns:
threshold Queue threshold, below which we will request more items
- Type
- number
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
reset()
#
Reset the queue and all its providers.
- Inherited from:
- Source:
setLang(lang)
#
Set language for the query results.
Parameters:
Name | Type | Description |
---|---|---|
lang |
string
|
undefined
|
Language |
- Inherited from:
- Source:
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:
setProviders(providers)
#
Set the providers.
Parameters:
Name | Type | Description |
---|---|---|
providers |
Array.<mw.widgets.APIResultsProvider> | An array of providers |
- Inherited from:
- Source:
setThreshold(threshold)
#
Set queue threshold.
Parameters:
Name | Type | Description |
---|---|---|
threshold |
number | Queue threshold, below which we will request more items |
- Inherited from:
- Source:
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