Extends
Properties
getRequestPromise
#
Get an API request promise to deal with a list of titles
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 |
- Overrides:
- Source:
Returns:
Promise that will be resolved with the data once it's available
- Type
- jQuery.Promise
getCached(name) → {Object|undefined
}
#
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 |
- Inherited from:
- Source:
Returns:
Cache data for this name.
- Type
-
Object
|
undefined
processQueue()private
#
Perform any scheduled API requests.
- Inherited from:
- Source:
Fires:
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 |
- Inherited from:
- Source:
Fires:
setAssumeExistence(assume)
#
Enable or disable automatic assumption of existence.
While enabled, any get() for a title that's not already in the cache will return { missing: false } and write that to the cache.
Parameters:
Name | Type | Description |
---|---|---|
assume |
boolean | Assume all uncached titles exist |
setMissing(entries)
#
Set link missing data
Stored separately from the full link data cache
Parameters:
Name | Type | Description |
---|---|---|
entries |
Object | Object keyed by page title, with the values being data objects |
Set link missing data
Stored separately from the full link data cache
styleElement(title, $element, [hasFragment])
#
Requests information about the title, then adds classes to the provided element as appropriate.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
title |
string | |||
$element |
jQuery | Element to style |
||
hasFragment |
boolean |
optional |
false | Whether the link goes to a fragment |
styleParsoidElements($elements, doc)
#
Given a chunk of Parsoid HTML, applies style transformations.
Previously this was used for applying red-link styles, but that has since been upstreamed to Parsoid.
TODO: Evaluate if this method should be renamed/removed as it now has nothing to do with the link cache.
Parameters:
Name | Type | Description |
---|---|---|
$elements |
jQuery | Elements to style |
doc |
HTMLDocument | Base document to use for normalisation |
getIconForLink(linkData) → {string}static
#
Get the icon name to use for a particular link type
Parameters:
Name | Type | Description |
---|---|---|
linkData |
Object | Link data |
Returns:
Icon name
- Type
- string