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

@manojadams/session-store

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@manojadams/session-store

Simple state management with session storage

  • 1.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-92.31%
Maintainers
1
Weekly downloads
 
Created
Source

session-store

Simple state management with session storage

Example usage:

1) Define your data

interface IUser {
  name: string;
  email: string;
  age: number;
  gender: string;
}

2) Create your store class and inherit SessionStore like below

class UserStore extends SessionStore<IUser> {
  
}

3) Define your getters and setters like below

class UserStore extends SessionStore<IUser> {
  get users() {
    return this.getData("_users");
  }
  set users(users: Array<IUser>) {
    this.setData("_users", users);
  }
}

4) Handle store lifecycle

  useEffect(() => {
    // initialize store
    UserStore.init();
    return () => {
      // destroy store
      UserStore.destroy();
    }
  }, []);
  

Keywords

FAQs

Package last updated on 27 Oct 2022

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