Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-react-native-http-cache

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-react-native-http-cache

Control http cache used by fetch/XMLHttpRequest

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

React Native http cache control for both fetch/XMLHttpRequest and ImageView

  • iOS
  • Android

Installation

$ npm install rc-react-native-http-cache --save

iOS: Linking in your XCode project

  • Link rc-react-native-http-cache library from your node_modules/rc-react-native-http-cache/ios folder like its described here. Don't forget to add it to "Build Phases" of project.

Android: Linking to your gradle Project

  • Add following lines into android/settings.gradle
include ':RCTHttpCache'
project(':RCTHttpCache').projectDir = new File(rootProject.projectDir, '../node_modules/rc-react-native-http-cache/android')
  • Add following lines into your android/app/build.gradle in section dependencies
...
dependencies {
   ...
   compile project(':RCTHttpCache')    // Add this line only.
}
  • Add following lines into MainActivity.java
...
import cn.reactnative.httpcache.HttpCachePackage;
      // Add this line before public class MainActivity

public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ...
        mReactInstanceManager = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setBundleAssetName("index.android.bundle")
            .setJSMainModuleName("index.android")
            .addPackage(new MainReactPackage())
            .addPackage(new HttpCachePackage())        // Add this line
            .setUseDeveloperSupport(BuildConfig.DEBUG)
            .setInitialLifecycleState(LifecycleState.RESUMED)
            .build();
    }
}
  • Add these lines to 'proguard-rules.pro' if you need to minify your java code:
-keep class com.facebook.cache.disk.DiskStorageCache {
   private boolean maybeUpdateFileCacheSize();
}

JavaScript: import all and invoke!

import * as CacheManager from 'rc-react-native-http-cache';

// invoke API directly when in need
CacheManager.clear();

API Documentation

clear()

Clear cache for all type.

Return a promise which indicate the clear state.

getSize()

Get cache size for all type.

Return a promise that contain the cache size(in bytes).

clearHttpCache()

Clear cache for fetch/ajax only.

Return a promise which indicate the clear state.

getHttpCacheSize()

Get cache size for fetch/ajax only.

Return a promise that contain the cache size(in bytes).

clearImageCache()

Clear cache for ImageView only.

Return a promise which indicate the clear state.

getImageCacheSize()

Get cache size for ImageView only.

Return a promise that contain the cache size(in bytes).

rc-react-native-http-cache

Keywords

FAQs

Package last updated on 01 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc