New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-preference

Package Overview
Dependencies
Maintainers
4
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-preference

Manage react-native app's preference data synchronously

  • 2.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
51
increased by8.51%
Maintainers
4
Weekly downloads
 
Created
Source

react-native-preference

Manage react-native app's preference data synchronously

Installation

# install library from npm
npm install react-native-preference --save

Usage

Import

import Preference from 'react-native-preference';

Get

Preference.get(key?: String)


// get all preferences
const preferences = Preference.get();

// get preference named `some-preference` 
const preference = Preference.get('some-preference');

Set

Preference.set(key: string, value?: string): Promise<void>


// set preference
Preference.set('key', 'value');

Clear

Preference.clear(key?: string): Promise<void>

// clear all preference data
Preference.clear();

// clear preference for key 'foo'
Preference.clear('foo');

White List

// set keys to white list, when preference value changed in white list changed, listener calls back.
    Preference.setWhiteList(['a', 'b', 'c']);
    Preference.addPreferenceChangedListener((changed) => {
        console.log('preference has changed: changed');
    });

Keywords

FAQs

Package last updated on 05 Nov 2021

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