npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

angular-webstorage

v0.1.2

Published

An Angular module that gives you access to the browsers local storage

Downloads

1,720

Readme

angular-web-storage

This module is destined to be used with AngularJS. It allow you to store data in the web storage of your browser.

You can use this module from 2 different ways.

Simple way

You can use the methods without use the optional parameter "storageType". This way, the module manage your data between session and local storage without you need to worry about how your data are managed.

Advanced usage

Using optional "storageType" parameters offers you more possibilites to manage your data. You can precise where to store or get your data (between session and local storage).

All methods are based on a param storage type to give you the possibility to manage your data as you want.

Table of contents

Get Started

  1. Get the module

    Via npm
    $ npm install angular-webstorage
    Via git

    Download the repository and take the angular-webstorage.js file from dist repository.

  2. Include the module into your angular application. Include angular-webstorage.js (or angular-webstorage.min.js) file in index.html, after the Angular import.

  3. Add WebStorageModule to your angular modules

API Documentation

get(key, storageType)

Get value from storage. By default, without storageType, value is took from session but if no value is find from session, the method try to find a value from local storage.

Params

  • key (string): data identifier
  • storageType (string, optional): where to find the data between 'sessionStorage' and 'localStorage'

Return

  • value if it find, undefined otherwise

Example

var value1 = AngularWebStorage.get('foo'); // return value corresponding to 'foo' from session or local storage
var value2 = AngularWebStorage.get('key', 'localStorage'); // return value corresponding to 'key' from local storage

set(key, value, keep)

Add value in web storage. By default, without keep param, value is stored in session.

Params

  • key (string): data identifier
  • value (object): value to store
  • keep (boolean, optional): if true data is stored in local, if false data is stored in session

Return

  • boolean: true if the data was stored well, false otherwise

Example

AngularWebStorage.set('foo', 'toto'); // store the data in session
AngularWebStorage.set('foo', 'toto', false); // store the data in session
AngularWebStorage.set('foo', 'toto', true); // store the data in local

remove(key, storageType)

Remove data from web storage. By default, without storageType, data corresponding to key is removed from session and local storage.

Params

  • key (string): data identifier
  • storageType (string, optional): where to find the data between 'sessionStorage' and 'localStorage'

Example

AngularWebStorage.remove('foo1'); // remove the data from session and local storage
AngularWebStorage.remove('foo2', 'sessionStorage'); // remove the data from session storage
AngularWebStorage.remove('foo2', 'localStorage'); // remove the data from local storage

clearAll(storageType)

Clear all datas from local, session or both storage.

Params

  • storageType (string, optional): where to remove the data between 'sessionStorage' and 'localStorage'

Example

AngularWebStorage.clearAll(); // remove all data from session and local storage
AngularWebStorage.clearAll('sessionStorage'); // remove all data from session storage
AngularWebStorage.clearAll('localStorage'); // remove all data from local storage

keys(storageType)

Return all keys from local, session or both storage. By default, without storageType, all keys (from session and local) are returned (the doublon between session and local are mixed)

Params

  • storageType (string, optional): where to find the keys between 'sessionStorage' and 'localStorage'

Example

AngularWebStorage.keys(); // return all keys from session and local storage
AngularWebStorage.keys('sessionStorage'); // return all keys from session storage
AngularWebStorage.keys('localStorage'); // return all leys from local storage

Change log

  • v0.1.0
  • Initial commit

Development

I encourage you to propose new functionality or suggestion to improve the project.

  1. Fork the project

  2. Clone the projet

    git clone https://github.com/<username>/angular-web-storage.git
  3. Install dependencies

    npm install
    bower install
  4. Launch test to be sure that everything work

    grunt test
  5. Minify source file

    grunt dist
  6. Check syntax

    grunt jshint

Don't forget to write tests and pass jshint syntax before to pull request please.