Socket
Book a DemoInstallSign in
Socket

cdl-sessionstorage

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cdl-sessionstorage

This is a simple session storage which is developed using javascript.

0.0.5
latest
npmnpm
Version published
Weekly downloads
8
300%
Maintainers
1
Weekly downloads
 
Created
Source

SessionStorage

This is a simple session storage which is developed using javascript.

Installation instruction

npm install cdl-sessionstorage --save

Instruction to use the package

How to use?

Please follow below instruction to implement session storage in your angular application.

//in module
import { SessionstorageModule } from 'cdl-sessionstorage'; 

imports: [
    SessionstorageModule
]

// In your component ts file

import { SessionstorageService } from 'cdl-sessionstorage';

First way to utilize service

// Extend service to utilize its functions

export class AppComponent extends SessionstorageService {

    constructor() {
        super();
    }

    ngOnInit() {

        //Set value in session storage by key value pair
        this.setValue(key, value);

        //Get value from session storage by key
        this.getValue(key);

        //Clear specific value in session storage by key
        this.clearValue(key);

        //Clear entire session storage
        this.clearAll();
    }
}

Second way to utilize service

// Initilize service to constructor

export class AppComponent {

    constructor(private sessionstorageService: SessionstorageService) {
        //TODO:
    }

    ngOnInit() {
        //Set value in session storage by key value pair
        this.sessionstorageService.setValue(key, value);

        //Get value from session storage by key
        this.sessionstorageService.getValue(key);
        
        //Clear specific value in session storage by key
        this.sessionstorageService.clearValue(key);
        
        //Clear entire session storage
        this.sessionstorageService.clearAll();
    }
}

Keywords

storage

FAQs

Package last updated on 22 Oct 2019

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.