Options
All
  • Public
  • Public/Protected
  • All
Menu

Class VirtualArray<T>

Advanced array like class that helps loading items on demand.

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

Properties

Private _cache

_cache: object

Type declaration

    _isViewBase

    _isViewBase: boolean

    Private _length

    _length: number

    Private _loadSize

    _loadSize: number

    Gets or sets load size for the virtual array.

    Private _loadedIndexes

    _loadedIndexes: number[]

    Private _requestedIndexes

    _requestedIndexes: number[]

    Static changeEvent

    changeEvent: string

    String value used when hooking to change event.

    Static itemsLoadingEvent

    itemsLoadingEvent: string

    String value used when hooking to itemsLoading event.

    Static propertyChangeEvent

    propertyChangeEvent: string

    Accessors

    length

    • get (): number
    • set (value: number): void

    loadSize

    • get (): number
    • set (value: number): void

    Methods

    _createPropertyChangeData

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

    _emit

    • _emit(eventNames: string): void

    addEventListener

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

    get

    • get(name: string): any

    getItem

    • getItem(index: number): T

    hasListeners

    • hasListeners(eventName: string): boolean

    load

    • load(index: number, items: T[]): void

    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): void
    • on(event: "itemsLoading", callback: function, thisArg?: any): void
    • on(event: "change", callback: function, thisArg?: any): void
    • 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 void

    • Raised when still not loaded items are requested.

      Parameters

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

      Returns void

    • Raised when a change occurs.

      Parameters

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

      Returns void

    once

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

    removeEventListener

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

    Private requestItems

    • requestItems(index: number): void

    set

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

    setItem

    • setItem(index: number, value: T): 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