Module-documentation

version 1.0.0
module: client-storage
maintanance: Marco Asbreuk
home
all modules

Usage ITSA.localStorage

This example shows how data can be stored using ITSA.localStorage

Code-example:

<script src="itsabuild-min.js"></script>
<script>
    var savePromise = ITSA.localStorage.set('president1', {name: 'Barack', lastName: 'Obama', 'birth': 1961});

    // wait for saving to be finished before reading it
    savePromise.then(
        function() {
            ITSA.localStorage.get('president1').then(
                function(president) {
                    ITSA.alert('found: '+president.name+' '+president.lastName);
                }
            ).catch(function(err) {ITSA.warn(err);});
        }
    ).catch(function(err) {ITSA.warn(err);})
    .finally(function() {
        // cleanup
        ITSA.localStorage.delete('president1');
    });

</script>
API Docs