# ImageCacheIt

NativeScript ImageCacheIt on NPM NativeScript ImageCacheIt on NPM follow on Twitter

Android Device Android Emulator iOS Device iOS Simulator
✅ ✅ ✅ ✅

# Installing

    ns plugin add @triniwiz/nativescript-image-cache-it

# Configuration

# Core

IMPORTANT

Ensure you've included xmlns:ui="@triniwiz/nativescript-image-cache-it" on the Page element

<ui:ImageCacheIt src="https://source.unsplash.com/random" width="300" height="300"/>

# Angular

import { ImageCacheItModule } from '@triniwiz/nativescript-image-cache-it/angular';

@NgModule({
    imports: [
    ImageCacheItModule
    ],
    declarations: [
        AppComponent
    ],
    bootstrap: [AppComponent]
})

# Vue

import { registerElement } from "nativescript-vue'";
registerElement('ImageCacheIt', () => require('@triniwiz/nativescript-image-cache-it').ImageCacheIt);

# Usage

import { ImageCacheIt } from '@triniwiz/nativescript-image-cache-it';
// add to the app.ts/ main.ts/ app.js to enable image-cache to hook into the device's lowmemory events
ImageCacheIt.enableAutoMM();

# API

# Properties

Property Default Type iOS Android Notes
src undefined string ✅ ✅
imageSource undefined ImageSource ✅ ✅
placeHolder undefined any ✅ ✅ local url | platform asset
errorHolder undefined any ✅ ✅ local url | platform asset
stretch "aspectFit" Stretch ✅ ✅
filter undefined string ✅ ✅ Web Filters 🎉 (opens new window)
transition None Transition ✅ ✅
fallback undefined any ✅ ✅ local url | platform asset
priority Normal Priority ✅ ✅
tintColor undefined Color | string ✅ ✅
overLayColor undefined Color | string ✅ ✅
loadMode async sync | async ✅ ✅
isLoading false boolean ✅ ✅
progress 0 number ✅ ✅
isLoading false boolean ✅ ✅
headers undefined Map<string,string> ✅ ✅

# Static Properties

Property Value Type iOS Android Notes
onLoadStartEvent "loadStart" string ✅ ✅
onProgressEvent "progress" string ✅ ✅
onErrorEvent "error" string ✅ ✅
onLoadEndEvent "loadEnd" sting ✅ ✅

# Methods

Method Type
on(event: 'loadStart', callback: (args: any) => void, thisArg?: any); void
on(event: 'progress', callback: (args: any) => void, thisArg?: any); void
on(event: 'error', callback: (args: any) => void, thisArg?: any); void
on(event: 'loadEnd', callback: (args: any) => void, thisArg?: any); void

# Static Methods

Method Type iOS Android Notes
getItem(src: string) Promise<string> ✅ ✅ cache remote url then returns local path if url has not been cached before
deleteItem(src: string) Promise<any> ✅ ❌ deletes local item cached for the url supplied
hasItem(src: string) Promise<any> ✅ ✅ resolves if an item is currently cached for remote url supplied.
clear() Promise<any> ✅ ✅
enableAutoMM void ✅ ✅
disableAutoMM void ✅ ✅

# Enums

# Transition

Members Value
Fade "fade"
None "none"

# Priority

Members Value
Low 0
Normal 1
High 2
Last Updated: 12/28/2020, 6:12:38 AM