Socket
Book a DemoInstallSign in
Socket

@copart/ops-local-storage

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@copart/ops-local-storage

latest
npmnpm
Version
0.0.1
Version published
Maintainers
2
Created
Source
import { storage } from '@copart/yard-local-storage'

// NOTE: You SHOULD NOT be complex values in localStorage.
// localStorage is a simple key and string value mapping,
// not a database. If you find yourself storing complex
// values, consider flattening the value and storing each
// value separately.

// Set an item namespaced for your application.
storage.setItem('foo', 'foofoo')
storage.setItem('bar', false)
storage.setItem('baz', ['a', 'b', 'c'])
storage.getItem('baz')
// "<appName>.baz" -> ['a', 'b', 'c']

// Get localStorage data persisted by another application.
stprage.getStorage('dashboard')
stprage.getStorage('login')
stprage.getStorage('dispatchg2')

// Get nested value persisted by another application.
storage.getPath('login.userData.email')

// Built in helper to automatically check necessary authentication values.
storage.checkAuth()

// For storing temporary data that will not persist in the case of
// refresh, new tab, etc. (Does not actually go into localStorage.)
storage.setTempItem('cool', true)

// Allows you to retrieve the config stored by ConfigManager.
storage.getConfig()

// Provides all localStorage values that belong to your app's namespace.
storage.inspect()

// When process.env.NODE_ENV === 'development', storage can be accessed
// on the global window object as window.yardLocalStorage. This is meant
// to be used for debugging ONLY and will NOT work in production.

FAQs

Package last updated on 08 Jun 2018

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