Skip to content

vladimirpavk/javascript-local_sesion_storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local and session storage examples

Local storage is accessed through window.localStorage object

Use

localStorage.setItem(key, value) to set the item in local storage
localStorage.getItem(key) to retrieve the value from the item in local storage
localStorage.clear() to erase everything in localStorage
localStorage.removeItem(key) in order to erase the specific key from the local storage

When trying to save object literals arrays use JSON.stringify(), JSON.parse

Use storage event to determine if change has happed on the local storage and StorageEvent object. Not working in all browsers.

Based on express-web-design repo

Node, Express, Gulp, BrowserSync, HTML For web designers. When html or css file in client folder is changed automatically refreshes targeted browsers.

Prerequisites

Must have node, npm, gulp, typings installed

How to use

Install node dependencies in your project root directory (this is where the 'package.json' file is located) using:

$ npm install

Install typescript definitions using:

$ typings init
$ typings install

Start application with

$ gulp

Application will be initialy compiled and started. By default the server is listening on port 3036. Browser synchronization is configured in proxy mode. Client application (Angular2) can be accessed through your web browser on the following url localhost:3033/www. If everything is ok you should see the rendered HTML file client/index.html in your browser.

Under the hood

You can configure targeted browsers for synchronization in gulpfile.js

gulp.task('configure_browser-sync', function(){
    return browserSync.init(
        {
            browser: ["chrome", "firefox", "opera"],
            proxy: "http://localhost:3033/www"                       
        }
    );
});

About

Javascript Local and Session storage example application

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published