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

angular2-locker

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-locker

angular2 library for managing session and locker storage, has backup for inmemory if neither are supported

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

angular2-locker

Build Status Code Climate

Wrapper around sessionStorage and localStorage for angular2. If both are unavailable will use an in memory storage.

Getting Started

$ npm i --save angular2-locker
import {bootsrap, provide} from 'angular2/core'
import {Locker, LockerConfig} from 'angular2-locker'

bootstrap(App, [Locker])

// If you need to specify more you can provide configuration
bootstrap(App, [provide(LockerConfig, {
  useValue: new LockerConfig('MyNamespace', Locker.DRIVERS.LOCAL)
})), Locker])

class App {
  constructor(private locker: Locker) {}
}

Methods

####get locker.get('myKey')

####set

locker.set('myKey', 'value')
locker.set('myKey', {object: 'value'})

####key

locker.set('key', 'value')

locker.key(0) // 'key'

####has locker.has('key')

####setNamespace locker.setNamespace('myName')

####useDriver

// for more info on drivers look for static methods
var driver = locker.useDriver(Locker.DRIVERS.LOCAL)

driver.set('keey', 'value')

####remove locker.remove('key')

####clear locker.clear()

Static Methods

DRIVERS

These are the types of drivers available. If you try to set it to a driver that is unsupported it will fallback to the memory driver Types are available under Locker.DRIVERS or import {DRIVERS} from 'angular2-locker'

  • DRIVERS.SESSION - Session Cache
  • DRIVERS.LOCAL - Local Storage
  • DRIVERS.MEMORY - Memory Storage
  • DRIVERS.COOKIE - Cookies

Keywords

FAQs

Package last updated on 14 May 2016

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