NativeScript 9.1 Released → V8 14.9, Vite 8 HMR, built for rapid agentic visual iteration
Dig in

Defined in: ui/image-cache/index.d.ts:29

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

Extends ​

Constructors ​

Constructor ​

ts
new ImageCache(): Cache;

Returns ​

Cache

Inherited from ​

Observable.constructor

Properties ​

maxRequests ​

ts
maxRequests: number;

Defined in: ui/image-cache/index.d.ts:45

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


placeholder ​

ts
placeholder: ImageSource;

Defined in: ui/image-cache/index.d.ts:41

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


downloadedEvent ​

ts
static downloadedEvent: string;

Defined in: ui/image-cache/index.d.ts:33

String value used when hooking to downloaded event.


downloadErrorEvent ​

ts
static downloadErrorEvent: string;

Defined in: ui/image-cache/index.d.ts:37

String value used when hooking to download error event.


propertyChangeEvent ​

ts
static propertyChangeEvent: string;

Defined in: data/observable/index.ts

String value used when hooking to propertyChange event.

Ns Event ​

propertyChange

Inherited from ​

Observable.propertyChangeEvent

Methods ​

_createPropertyChangeData() ​

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

Defined in: data/observable/index.ts

This method is intended to be overriden by inheritors to provide additional implementation.

Parameters ​

ParameterType
propertyNamestring
valueany
oldValue?any

Returns ​

PropertyChangeData

Inherited from ​

Observable._createPropertyChangeData


_emit() ​

ts
_emit(eventName: string): void;

Defined in: data/observable/index.ts

Parameters ​

ParameterType
eventNamestring

Returns ​

void

Inherited from ​

Observable._emit


addEventListener() ​

ts
addEventListener(
   eventName: string, 
   callback: (data: EventData) => void, 
   thisArg?: any, 
   once?: boolean): void;

Defined in: data/observable/index.ts

Adds a listener for the specified event name.

Parameters ​

ParameterTypeDescription
eventNamestringName of the event to attach to.
callback(data: EventData) => voidA function to be called when some of the specified event(s) is raised.
thisArg?anyAn optional parameter which when set will be used as "this" in callback method call.
once?booleanAn optional parameter which when set will cause the event listener to fire once.

Returns ​

void

Inherited from ​

Observable.addEventListener


clear() ​

ts
clear(): void;

Defined in: ui/image-cache/index.d.ts:80

Removes all the previously cached images.

Returns ​

void


disableDownload() ​

ts
disableDownload(): void;

Defined in: ui/image-cache/index.d.ts:54

Temporary disables download requests.

Returns ​

void


enableDownload() ​

ts
enableDownload(): void;

Defined in: ui/image-cache/index.d.ts:50

Enables previously suspended download requests.

Returns ​

void


enqueue() ​

ts
enqueue(request: DownloadRequest): any;

Defined in: ui/image-cache/index.d.ts:63

Adds a new download request at the end of the download queue. This will be the last download to start.

Parameters ​

ParameterType
requestDownloadRequest

Returns ​

any


get() ​

ts
get(key: string): any;

Defined in: ui/image-cache/index.d.ts:68

Gets the image for the specified key. May be undefined if the key is not present in the cache.

Parameters ​

ParameterType
keystring

Returns ​

any

Overrides ​

Observable.get


hasListeners() ​

ts
hasListeners(eventName: string): boolean;

Defined in: data/observable/index.ts

Checks whether a listener is registered for the specified event name.

Parameters ​

ParameterTypeDescription
eventNamestringThe name of the event to check for.

Returns ​

boolean

Inherited from ​

Observable.hasListeners


notify() ​

ts
notify<T>(data: T): void;

Defined in: data/observable/index.ts

Notify this Observable instance with some data. This causes all event handlers on the Observable instance to be called, as well as any 'global' event handlers set on the instance's class.

Type Parameters ​

Type Parameter
T extends Optional<EventData, "object">

Parameters ​

ParameterTypeDescription
dataTan object that satisfies the EventData interface, though with an optional 'object' property. If left undefined, the 'object' property will implicitly be set as this Observable instance.

Returns ​

void

Inherited from ​

Observable.notify


notifyPropertyChange() ​

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

Defined in: data/observable/index.ts

Notifies all the registered listeners for the property change event.

Parameters ​

ParameterType
namestring
valueany
oldValue?any

Returns ​

void

Inherited from ​

Observable.notifyPropertyChange


off() ​

ts
off(
   eventName: string, 
   callback?: (data: EventData) => void, 
   thisArg?: any): void;

Defined in: data/observable/index.ts

Removes the listener(s) for the specified event name.

Parameters ​

ParameterTypeDescription
eventNamestringThe name of the event.
callback?(data: EventData) => voidAn optional specific event listener to remove (if omitted, all event listeners by this name will be removed).
thisArg?anyAn optional parameter which, when set, will be used to refine search of the correct event listener to be removed.

Returns ​

void

Inherited from ​

Observable.off


on() ​

Call Signature ​

ts
on(
   eventName: string, 
   callback: (args: EventData) => void, 
   thisArg?: any): void;

Defined in: ui/image-cache/index.d.ts:92

Adds a listener for the specified event name.

Parameters ​
ParameterTypeDescription
eventNamestringThe name of the event.
callback(args: EventData) => voidThe event listener to add. Will be called when an event of the given name is raised.
thisArg?anyAn optional parameter which, when set, will be bound as the this context when the callback is called. Falsy values will be not be bound.
Returns ​

void

Overrides ​

Observable.on

Call Signature ​

ts
on(
   event: "downloaded", 
   callback: (args: DownloadedData) => void, 
   thisArg?: any): void;

Defined in: ui/image-cache/index.d.ts:97

Raised when the image has been downloaded.

Parameters ​
ParameterType
event"downloaded"
callback(args: DownloadedData) => void
thisArg?any
Returns ​

void

Overrides ​
ts
Observable.on

Call Signature ​

ts
on(
   event: "downloadError", 
   callback: (args: DownloadError) => void, 
   thisArg?: any): void;

Defined in: ui/image-cache/index.d.ts:102

Raised if the image download errors.

Parameters ​
ParameterType
event"downloadError"
callback(args: DownloadError) => void
thisArg?any
Returns ​

void

Overrides ​
ts
Observable.on

once() ​

ts
once(
   eventName: string, 
   callback: (data: EventData) => void, 
   thisArg?: any): void;

Defined in: data/observable/index.ts

Adds a listener for the specified event name, which, once fired, will remove itself.

Parameters ​

ParameterTypeDescription
eventNamestringThe name of the event.
callback(data: EventData) => voidThe event listener to add. Will be called when an event of the given name is raised.
thisArg?anyAn optional parameter which, when set, will be bound as the this context when the callback is called. Falsy values will be not be bound.

Returns ​

void

Inherited from ​

Observable.once


push() ​

ts
push(request: DownloadRequest): any;

Defined in: ui/image-cache/index.d.ts:59

Adds a new download request at the top of the download queue. This will be the next immediate download to start.

Parameters ​

ParameterType
requestDownloadRequest

Returns ​

any


remove() ​

ts
remove(key: string): void;

Defined in: ui/image-cache/index.d.ts:76

Removes the cache for the specified key.

Parameters ​

ParameterType
keystring

Returns ​

void


removeEventListener() ​

ts
removeEventListener(
   eventName: string, 
   callback?: (data: EventData) => void, 
   thisArg?: any): void;

Defined in: data/observable/index.ts

Removes listener(s) for the specified event name.

Parameters ​

ParameterTypeDescription
eventNamestringName of the event to attach to.
callback?(data: EventData) => voidAn optional parameter pointing to a specific listener. If not defined, all listeners for the event names will be removed.
thisArg?anyAn optional parameter which when set will be used to refine search of the correct callback which will be removed as event listener.

Returns ​

void

Inherited from ​

Observable.removeEventListener


set() ​

ts
set(key: string, image: any): void;

Defined in: ui/image-cache/index.d.ts:72

Sets the image for the specified key.

Parameters ​

ParameterType
keystring
imageany

Returns ​

void

Overrides ​

Observable.set


setProperty() ​

ts
setProperty(name: string, value: any): void;

Defined in: data/observable/index.ts

Updates the specified property with the provided value and raises a property change event and a specific change event based on the property name.

Parameters ​

ParameterType
namestring
valueany

Returns ​

void

Inherited from ​

Observable.setProperty


addEventListener() ​

ts
static addEventListener(
   eventName: string, 
   callback: (data: EventData) => void, 
   thisArg?: any, 
   once?: boolean): void;

Defined in: data/observable/index.ts

Please avoid using the static event-handling APIs as they will be removed in future.

Parameters ​

ParameterType
eventNamestring
callback(data: EventData) => void
thisArg?any
once?boolean

Returns ​

void

Deprecated ​

Inherited from ​

Observable.addEventListener


off() ​

ts
static off(
   eventName: string, 
   callback?: (data: EventData) => void, 
   thisArg?: any): void;

Defined in: data/observable/index.ts

Please avoid using the static event-handling APIs as they will be removed in future.

Parameters ​

ParameterType
eventNamestring
callback?(data: EventData) => void
thisArg?any

Returns ​

void

Deprecated ​

Inherited from ​

Observable.off


on() ​

ts
static on(
   eventName: string, 
   callback: (data: EventData) => void, 
   thisArg?: any, 
   once?: boolean): void;

Defined in: data/observable/index.ts

Please avoid using the static event-handling APIs as they will be removed in future.

Parameters ​

ParameterType
eventNamestring
callback(data: EventData) => void
thisArg?any
once?boolean

Returns ​

void

Deprecated ​

Inherited from ​

Observable.on


once() ​

ts
static once(
   eventName: string, 
   callback: (data: EventData) => void, 
   thisArg?: any): void;

Defined in: data/observable/index.ts

Please avoid using the static event-handling APIs as they will be removed in future.

Parameters ​

ParameterType
eventNamestring
callback(data: EventData) => void
thisArg?any

Returns ​

void

Deprecated ​

Inherited from ​

Observable.once


removeEventListener() ​

ts
static removeEventListener(
   eventName: string, 
   callback?: (data: EventData) => void, 
   thisArg?: any): void;

Defined in: data/observable/index.ts

Please avoid using the static event-handling APIs as they will be removed in future.

Parameters ​

ParameterType
eventNamestring
callback?(data: EventData) => void
thisArg?any

Returns ​

void

Deprecated ​

Inherited from ​

Observable.removeEventListener

Previous
ImageAsset