Class: ReferencesMobileViewGateway

ReferencesMobileViewGateway(api, cacheopt)

new ReferencesMobileViewGateway(api, cacheopt)

Gateway for retrieving references via the MobileView API

By default not cached, if it receives a cache instance then it will be used to store and get references sections.

Parameters:
Name Type Attributes Description
api mw.Api

class to use for making requests

cache NoCache | MemoryCache <optional>

class to use for caching request results. By default it uses the NoCache implementation, which doesn't cache anything. The singleton instance exposed by this module uses a MemoryCache which caches requests in-memory. Any other Cache class compatible with mobile.startup/cache's interface will actually work.

Source:

Extends

Members

getReference

Return the matched reference via API or DOM query

Overrides:
Source:

Methods

(static) getSingleton() → {ReferencesMobileViewGateway}

Retrieve a singleton instance w/ cache that uses mw.Api

Source:
Returns:
Type
ReferencesMobileViewGateway

getReferenceFromContainer(id, $container) → {jQuery.Promise}

Parameters:
Name Type Description
id string

of a DOM element in the page with '#' prefix. can be encoded or decoded.

$container jQuery.Object

to scan for an element

Inherited From:
Source:
Returns:

that can be used by getReference

Type
jQuery.Promise

getReferencesList(page, headingId) → {jQuery.Promise}

Retrieve all the references lists for a given page and section ID.

Parameters:
Name Type Description
page Page
headingId string
Source:
Returns:

promise that resolves with the section HTML or false if no such section exists

Type
jQuery.Promise

getReferencesLists(page) → {jQuery.Deferred}

Retrieve references list for a given page. Also cache the result for a later use.

Parameters:
Name Type Description
page Page
Source:
Returns:

promise that resolves with the list of sections on the page

Type
jQuery.Deferred