| title | ImageCache |
|---|---|
| titleTemplate | title - API / NativeScript |
| description | Represents a class that stores handles image download requests and caches the already downloaded images. |
| contributors | false |
Defined in: ui/image-cache/index.d.ts:29
Represents a class that stores handles image download requests and caches the already downloaded images.
new ImageCache(): Cache;Cache
maxRequests: number;Defined in: ui/image-cache/index.d.ts:45
The maximum number of simultaneous download requests. Defaults to 5.
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.
static downloadedEvent: string;Defined in: ui/image-cache/index.d.ts:33
String value used when hooking to downloaded event.
static downloadErrorEvent: string;Defined in: ui/image-cache/index.d.ts:37
String value used when hooking to download error event.
static propertyChangeEvent: string;Defined in: data/observable/index.ts
String value used when hooking to propertyChange event.
propertyChange
Observable.propertyChangeEvent
_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.
| Parameter | Type |
|---|---|
propertyName |
string |
value |
any |
oldValue? |
any |
Observable._createPropertyChangeData
_emit(eventName: string): void;Defined in: data/observable/index.ts
| Parameter | Type |
|---|---|
eventName |
string |
void
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.
| Parameter | Type | Description |
|---|---|---|
eventName |
string |
Name of the event to attach to. |
callback |
(data: EventData) => void |
A function to be called when some of the specified event(s) is raised. |
thisArg? |
any |
An optional parameter which when set will be used as "this" in callback method call. |
once? |
boolean |
An optional parameter which when set will cause the event listener to fire once. |
void
clear(): void;Defined in: ui/image-cache/index.d.ts:80
Removes all the previously cached images.
void
disableDownload(): void;Defined in: ui/image-cache/index.d.ts:54
Temporary disables download requests.
void
enableDownload(): void;Defined in: ui/image-cache/index.d.ts:50
Enables previously suspended download requests.
void
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.
| Parameter | Type |
|---|---|
request |
DownloadRequest |
any
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.
| Parameter | Type |
|---|---|
key |
string |
any
hasListeners(eventName: string): boolean;Defined in: data/observable/index.ts
Checks whether a listener is registered for the specified event name.
| Parameter | Type | Description |
|---|---|---|
eventName |
string |
The name of the event to check for. |
boolean
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 Parameter |
|---|
T extends Optional<EventData, "object"> |
| Parameter | Type | Description |
|---|---|---|
data |
T |
an 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. |
void
notifyPropertyChange(
name: string,
value: any,
oldValue?: any): void;Defined in: data/observable/index.ts
Notifies all the registered listeners for the property change event.
| Parameter | Type |
|---|---|
name |
string |
value |
any |
oldValue? |
any |
void
Observable.notifyPropertyChange
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.
| Parameter | Type | Description |
|---|---|---|
eventName |
string |
The name of the event. |
callback? |
(data: EventData) => void |
An optional specific event listener to remove (if omitted, all event listeners by this name will be removed). |
thisArg? |
any |
An optional parameter which, when set, will be used to refine search of the correct event listener to be removed. |
void
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.
| Parameter | Type | Description |
|---|---|---|
eventName |
string |
The name of the event. |
callback |
(args: EventData) => void |
The event listener to add. Will be called when an event of the given name is raised. |
thisArg? |
any |
An optional parameter which, when set, will be bound as the this context when the callback is called. Falsy values will be not be bound. |
void
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.
| Parameter | Type |
|---|---|
event |
"downloaded" |
callback |
(args: DownloadedData) => void |
thisArg? |
any |
void
Observable.onon(
event: "downloadError",
callback: (args: DownloadError) => void,
thisArg?: any): void;Defined in: ui/image-cache/index.d.ts:102
Raised if the image download errors.
| Parameter | Type |
|---|---|
event |
"downloadError" |
callback |
(args: DownloadError) => void |
thisArg? |
any |
void
Observable.ononce(
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.
| Parameter | Type | Description |
|---|---|---|
eventName |
string |
The name of the event. |
callback |
(data: EventData) => void |
The event listener to add. Will be called when an event of the given name is raised. |
thisArg? |
any |
An optional parameter which, when set, will be bound as the this context when the callback is called. Falsy values will be not be bound. |
void
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.
| Parameter | Type |
|---|---|
request |
DownloadRequest |
any
remove(key: string): void;Defined in: ui/image-cache/index.d.ts:76
Removes the cache for the specified key.
| Parameter | Type |
|---|---|
key |
string |
void
removeEventListener(
eventName: string,
callback?: (data: EventData) => void,
thisArg?: any): void;Defined in: data/observable/index.ts
Removes listener(s) for the specified event name.
| Parameter | Type | Description |
|---|---|---|
eventName |
string |
Name of the event to attach to. |
callback? |
(data: EventData) => void |
An optional parameter pointing to a specific listener. If not defined, all listeners for the event names will be removed. |
thisArg? |
any |
An optional parameter which when set will be used to refine search of the correct callback which will be removed as event listener. |
void
Observable.removeEventListener
set(key: string, image: any): void;Defined in: ui/image-cache/index.d.ts:72
Sets the image for the specified key.
| Parameter | Type |
|---|---|
key |
string |
image |
any |
void
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.
| Parameter | Type |
|---|---|
name |
string |
value |
any |
void
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.
| Parameter | Type |
|---|---|
eventName |
string |
callback |
(data: EventData) => void |
thisArg? |
any |
once? |
boolean |
void
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.
| Parameter | Type |
|---|---|
eventName |
string |
callback? |
(data: EventData) => void |
thisArg? |
any |
void
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.
| Parameter | Type |
|---|---|
eventName |
string |
callback |
(data: EventData) => void |
thisArg? |
any |
once? |
boolean |
void
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.
| Parameter | Type |
|---|---|
eventName |
string |
callback |
(data: EventData) => void |
thisArg? |
any |
void
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.
| Parameter | Type |
|---|---|
eventName |
string |
callback? |
(data: EventData) => void |
thisArg? |
any |
void