Nativescript Image Cache
Nativescript image caching plugin using Fresco for Android and SDWebImageCache for iOS
Installation
tns plugin add nativescript-image-cache
Support NativeScript ~3.0.0 with Angular
Properties
Property Name | Value | Platform |
---|---|---|
stretch |
aspectFill, aspectFit, fill, none | ios,android |
src |
string | ios,android |
placeholder |
string | ios,android |
placeholderStretch |
aspectFill, aspectFit, fill, none | android |
radius |
number | android |
rounded |
boolean | android |
Basic Usage
Nativescript Angular
Initialization
;
Example usage:
Nativescript Vanilla
Initialization (android only)
const imageCache = ; if applicationandroid application;
Example usage:
Caching Image
Default cache purge time can be specified in number of days.
; ;setCacheLimitcacheLimitInDays;
Clearing Cache
Default cache time for SDWebImageCache is 7 days, and for Fresco is 60 days.
; clearCache;
(Android Only), you need to initialize in the application onlaunch event before clearing the cache
Credits
The starting point for this plugin was this great plugin.