Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ImageCache

Represents a class that stores handles image download requests and caches the already downloaded images.

Hierarchy

Index

Constructors

constructor

Properties

_isViewBase

_isViewBase: boolean

maxRequests

maxRequests: number

The maximum number of simultaneous download requests. Defaults to 5.

placeholder

placeholder: ImageSource

The image to be used to notify for a pending download request - e.g. loading indicator.

Static downloadErrorEvent

downloadErrorEvent: string

String value used when hooking to download error event.

Static downloadedEvent

downloadedEvent: string

String value used when hooking to downloaded event.

Static propertyChangeEvent

propertyChangeEvent: string

Methods

_createPropertyChangeData

  • _createPropertyChangeData(propertyName: string, value: any, oldValue?: any): PropertyChangeData

Private _downloadCore

_emit

  • _emit(eventNames: string): void

Private _onDownloadCompleted

  • _onDownloadCompleted(key: string, image: any): any

Private _onDownloadError

  • _onDownloadError(key: string, err: Error): any

addEventListener

  • addEventListener(eventNames: string, callback: function, thisArg?: any): void

clear

  • clear(): void

disableDownload

  • disableDownload(): void

enableDownload

  • enableDownload(): void

enqueue

get

  • get(key: string): any

hasListeners

  • hasListeners(eventName: string): boolean

notify

  • notify<T>(data: T): void

notifyPropertyChange

  • notifyPropertyChange(name: string, value: any, oldValue?: any): void

off

  • off(eventNames: string, callback?: any, thisArg?: any): void

on

  • on(eventNames: string, callback: function, thisArg?: any): any
  • on(event: "downloaded", callback: function, thisArg?: any): any
  • on(event: "downloadError", callback: function, thisArg?: any): any
  • A basic method signature to hook an event listener (shortcut alias to the addEventListener method).

    Parameters

    • eventNames: string

      String corresponding to events (e.g. "propertyChange"). Optionally could be used more events separated by , (e.g. "propertyChange", "change").

    • callback: function

      Callback function which will be executed when event is raised.

    • Optional thisArg: any

      An optional parameter which will be used as this context for callback execution.

    Returns any

  • Raised when the image has been downloaded.

    Parameters

    Returns any

  • Raised if the image download errors.

    Parameters

    • event: "downloadError"
    • callback: function
    • Optional thisArg: any

    Returns any

once

  • once(event: string, callback: function, thisArg?: any): void

push

remove

  • remove(key: string): void

removeEventListener

  • removeEventListener(eventNames: string, callback?: any, thisArg?: any): void

set

  • set(key: string, image: any): void

setProperty

  • setProperty(name: string, value: any): void

Static addEventListener

  • addEventListener(eventName: string, callback: any, thisArg?: any): void

Static off

  • off(eventName: string, callback?: any, thisArg?: any): void

Static on

  • on(eventName: string, callback: any, thisArg?: any): void

Static once

  • once(eventName: string, callback: any, thisArg?: any): void

Static removeEventListener

  • removeEventListener(eventName: string, callback?: any, thisArg?: any): void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method