Expand all

ImageProvider

Loads an image.

Constructor

new ImageProvider(imageQueryParameter) #

Parameters:

Name Type Description
imageQueryParameter string

When defined, is a query parameter to add to every image request

Source:

Properties

cacheprotected #

AJAX call cache.

Properties:

Name Type Description
cache Object.<string, jQuery.Promise>
Source:
AJAX call cache.

Methods

get(url) → {jQuery.Promise.<HTMLImageElement>} #

Loads an image and returns it. When the browser supports it, the image is loaded as an AJAX request.

Parameters:

Name Type Description
url string

Returns:

A promise which resolves to the image object. When loaded via AJAX, it has progress events, which return an array with the content loaded so far and with the progress as a floating-point number between 0 and 100.

Type
jQuery.Promise.<HTMLImageElement>
Source:
Loads an image and returns it.

imagePreloadingSupported() → {boolean} #

Checks whether the current browser supports AJAX preloading of images. This means that:

  • the browser supports CORS requests (large wiki farms usually host images on a separate domain) and
  • either AJAX and normal image loading uses the same cache (when an image is used by a CORS request, and then normally by setting img.src, it is only loaded once)
  • or (as is the case with Firefox) they are cached separately, but that can be changed by setting the crossOrigin attribute

Returns:

Type
boolean
Source:
Checks whether the current browser supports AJAX preloading of images.

rawGet(url, [cors]) → {jQuery.Promise.<HTMLImageElement>} #

Internal version of get(): no caching, no performance metrics.

Parameters:

Name Type Attributes Description
url string
cors boolean optional

if true, use CORS for preloading

Returns:

a promise which resolves to the image object

Type
jQuery.Promise.<HTMLImageElement>
Source:
Internal version of get(): no caching, no performance metrics.