Expand all

ve.init.mw.ApiResponseCache

Extends

Constructor

new ve.init.mw.ApiResponseCache([api]) #

MediaWiki API batch queue.

Used to queue up lists of items centrally to get information about in batches of requests.

Parameters:

Name Type Attributes Description
api mw.Api optional

API object to use. Defaults to new mw.Api()

Source:
MediaWiki API batch queue.

Properties

getRequestPromiseabstract #

Get an API request promise to deal with a list of titles

Source:
Get an API request promise to deal with a list of titles

processPageabstractstatic #

Process each page in the response of an API request

Source:
Process each page in the response of an API request

Methods

get(title) → {jQuery.Promise} #

Look up data about a title. If the data about this title is already in the cache, this returns an already-resolved promise. Otherwise, it returns a pending promise and schedules an request to retrieve the data.

Parameters:

Name Type Description
title string
Source:

Returns:

Promise that will be resolved with the data once it's available

Type
jQuery.Promise
Look up data about a title.

getCached(name) → {Object|undefined} #

Look up data about a page in the cache. If the data about this page is already in the cache, this returns that data. Otherwise, it returns undefined.

Parameters:

Name Type Description
name string

Normalized page title

Source:

Returns:

Cache data for this name.

Type
Object | undefined
Look up data about a page in the cache.

processQueue()private #

Perform any scheduled API requests.

set(entries) #

Add entries to the cache. Does not overwrite already-set entries.

Parameters:

Name Type Description
entries Object

Object keyed by page title, with the values being data objects

Source:

Fires:

Add entries to the cache.

normalizeTitle(title) → {string}static #

Parameters:

Name Type Description
title string
Source:

Returns:

Type
string

Events

add(entries) #

Fired when a new entry is added to the cache.

Parameters:

Name Type Description
entries Object

Cache entries that were added. Object mapping names to data objects.

Source:
Fired when a new entry is added to the cache.